diff --git a/.github/workflows/auto-tag.yml b/.github/workflows/auto-tag.yml new file mode 100644 index 0000000..291c7d8 --- /dev/null +++ b/.github/workflows/auto-tag.yml @@ -0,0 +1,55 @@ +name: Auto Tag on Merge + +on: + push: + branches: + - main + - master + +jobs: + tag: + runs-on: ubuntu-latest + permissions: + contents: write + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Get latest tag + id: get_latest_tag + run: | + # Get the latest tag, or use v1.0.0 if no tags exist + LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v1.0.0") + echo "latest_tag=${LATEST_TAG}" >> $GITHUB_OUTPUT + echo "Latest tag: ${LATEST_TAG}" + + - name: Bump version + id: bump_version + run: | + LATEST_TAG="${{ steps.get_latest_tag.outputs.latest_tag }}" + + # Remove 'v' prefix and split into parts + VERSION=${LATEST_TAG#v} + IFS='.' read -r -a VERSION_PARTS <<< "$VERSION" + + MAJOR="${VERSION_PARTS[0]}" + MINOR="${VERSION_PARTS[1]}" + PATCH="${VERSION_PARTS[2]}" + + # Increment patch version + PATCH=$((PATCH + 1)) + + NEW_TAG="v${MAJOR}.${MINOR}.${PATCH}" + echo "new_tag=${NEW_TAG}" >> $GITHUB_OUTPUT + echo "New tag: ${NEW_TAG}" + + - name: Create and push tag + run: | + NEW_TAG="${{ steps.bump_version.outputs.new_tag }}" + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git tag -a "${NEW_TAG}" -m "Release ${NEW_TAG}" + git push origin "${NEW_TAG}" diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml new file mode 100644 index 0000000..3303dfe --- /dev/null +++ b/.github/workflows/build-and-release.yml @@ -0,0 +1,103 @@ +name: Build and Release + +on: + push: + tags: + - 'v*' + pull_request: + branches: + - main + - master + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: '8.0.x' + + - name: Restore dependencies + run: dotnet restore CS2SimpleVote.csproj + + - name: Build project + run: dotnet build CS2SimpleVote.csproj --configuration Release --no-restore + + - name: Publish project + run: dotnet publish CS2SimpleVote.csproj --configuration Release --no-build --output ./publish + + - name: Create release package + run: | + mkdir -p release/addons/counterstrikesharp/plugins/CS2SimpleVote + cp publish/CS2SimpleVote.dll release/addons/counterstrikesharp/plugins/CS2SimpleVote/ + cp publish/CS2SimpleVote.pdb release/addons/counterstrikesharp/plugins/CS2SimpleVote/ + cp publish/CS2SimpleVote.deps.json release/addons/counterstrikesharp/plugins/CS2SimpleVote/ + + - name: Create zip file + run: | + if [ "${{ github.ref_type }}" = "tag" ]; then + ZIP_NAME="CS2SimpleVote-${{ github.ref_name }}.zip" + else + ZIP_NAME="CS2SimpleVote-build-${{ github.sha }}.zip" + fi + cd release && zip -r "../${ZIP_NAME}" . && cd .. + echo "ZIP_NAME=${ZIP_NAME}" >> $GITHUB_ENV + + - name: Upload build artifact + uses: actions/upload-artifact@v4 + with: + name: CS2SimpleVote-build + path: ${{ env.ZIP_NAME }} + retention-days: 7 + + release: + if: startsWith(github.ref, 'refs/tags/v') + needs: build + runs-on: ubuntu-latest + permissions: + contents: write + + steps: + - name: Download build artifact + uses: actions/download-artifact@v4 + with: + name: CS2SimpleVote-build + + - name: Create Release + uses: softprops/action-gh-release@v1 + with: + files: | + CS2SimpleVote-*.zip + body: | + ## CS2SimpleVote ${{ github.ref_name }} + + ### Installation + 1. Download `CS2SimpleVote-${{ github.ref_name }}.zip` + 2. Extract the contents to your Counter-Strike 2 server directory + 3. The plugin will be installed at `addons/counterstrikesharp/plugins/CS2SimpleVote/` + 4. Configure the plugin in `configs/plugins/CS2SimpleVote/CS2SimpleVote.json` + 5. Restart your server + + ### Requirements + - CounterStrikeSharp framework (v1.0.362 or later) installed on your server + - .NET 8.0 Runtime + - Steam Web API key for Workshop collection fetching + + ### Features + - Automated map voting at specific rounds + - Rock The Vote (RTV) system + - Map nomination with search support + - Recent map history filtering + - Workshop collection integration + - Interactive HUD alerts + - Admin controls + draft: false + prerelease: false + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/CS2SimpleVote.csproj b/CS2SimpleVote.csproj new file mode 100644 index 0000000..20d5338 --- /dev/null +++ b/CS2SimpleVote.csproj @@ -0,0 +1,17 @@ + + + + net8.0 + latest + Library + enable + enable + false + true + + + + + + +