From ccd29f598ddf07677efa6134976611aff82efbcf Mon Sep 17 00:00:00 2001 From: Christopher Lee Date: Mon, 16 Feb 2026 14:56:23 -0500 Subject: [PATCH 1/2] add action --- .github/workflows/build-and-release.yml | 95 +++++++++++++++++++++++++ CS2SimpleVote.csproj | 17 +++++ 2 files changed, 112 insertions(+) create mode 100644 .github/workflows/build-and-release.yml create mode 100644 CS2SimpleVote.csproj diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml new file mode 100644 index 0000000..a3c32f0 --- /dev/null +++ b/.github/workflows/build-and-release.yml @@ -0,0 +1,95 @@ +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/ + cd release + zip -r ../CS2SimpleVote-${{ github.ref_name || 'pr-build' }}.zip . + + - name: Upload build artifact + uses: actions/upload-artifact@v4 + with: + name: CS2SimpleVote-build + path: CS2SimpleVote-${{ github.ref_name || 'pr-build' }}.zip + 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-${{ github.ref_name }}.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 + + + + + + + From d622cf5b4e68c1f00f6d90420a4eda5ae6eae5b8 Mon Sep 17 00:00:00 2001 From: Christopher Lee Date: Mon, 16 Feb 2026 14:59:35 -0500 Subject: [PATCH 2/2] bump --- .github/workflows/auto-tag.yml | 55 +++++++++++++++++++++++++ .github/workflows/build-and-release.yml | 16 +++++-- 2 files changed, 67 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/auto-tag.yml 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 index a3c32f0..3303dfe 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -38,14 +38,22 @@ jobs: 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/ - cd release - zip -r ../CS2SimpleVote-${{ github.ref_name || 'pr-build' }}.zip . + + - 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: CS2SimpleVote-${{ github.ref_name || 'pr-build' }}.zip + path: ${{ env.ZIP_NAME }} retention-days: 7 release: @@ -65,7 +73,7 @@ jobs: uses: softprops/action-gh-release@v1 with: files: | - CS2SimpleVote-${{ github.ref_name }}.zip + CS2SimpleVote-*.zip body: | ## CS2SimpleVote ${{ github.ref_name }}