From 4aca609454887829d32d2809e36903912747e120 Mon Sep 17 00:00:00 2001 From: Rushaway <176180971+Rushaway@users.noreply.github.com> Date: Tue, 18 Aug 2026 13:20:08 +0200 Subject: [PATCH] ci: replace SourceKnight with native GitHub Actions workflow --- .github/copilot-instructions.md | 6 +- .github/workflows/build.yml | 103 -------------------------------- .github/workflows/ci.yml | 98 ++++++++++++++++++++++++++++++ .gitignore | 1 - sourceknight.yaml | 18 ------ 5 files changed, 101 insertions(+), 125 deletions(-) delete mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/ci.yml delete mode 100644 sourceknight.yaml diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 41b1ec5..7e0edc0 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -45,9 +45,9 @@ addons/sourcemod/ - Git for version control ### Build System -- **CI/CD**: GitHub Actions (`.github/workflows/build.yml`) -- **Dependency Management**: sourceknight.yaml -- **Compilation**: `spcomp VIP_Core.sp -E -o ../plugins/VIP_Core.smx -i./include` +- **CI/CD**: GitHub Actions (`.github/workflows/ci.yml`) +- **Dependency Management**: none (no external SourcePawn include dependencies beyond SourceMod itself) +- **Compilation**: `spcomp -i include -o ../plugins/VIP_Core.smx VIP_Core.sp` ### Local Development Setup ```bash diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index 9c83be3..0000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,103 +0,0 @@ -name: Build - -on: - push: - branches: - - master - tags: - - '*' - pull_request: - branches: - - master - workflow_dispatch: - -jobs: - compile: - runs-on: ubuntu-latest - continue-on-error: ${{ matrix.sm-version == '1.12.x' }} - strategy: - matrix: - sm-version: [ '1.11.x', '1.12.x' ] - - name: "Build SM ${{ matrix.sm-version }}" - steps: - - name: Prepare env - shell: bash - run: | - echo "GITHUB_SHA_SHORT=${GITHUB_SHA::7}" >> $GITHUB_ENV - SMVERSION_FULL=${{ matrix.sm-version }} - echo "SMVERSION_SHORT=${SMVERSION_FULL:0:-2}" >> $GITHUB_ENV - - - uses: actions/checkout@v5 - - - name: Setup SP - uses: rumblefrog/setup-sp@master - with: - version: ${{ matrix.sm-version }} - - - name: Run compiler - run: | - cd addons/sourcemod - mkdir plugins - cd scripting - spcomp VIP_Core.sp -E -o ../plugins/VIP_Core.smx -i./include - - - name: Upload artifact - uses: actions/upload-artifact@v4 - with: - name: VIP-Core-${{ env.SMVERSION_SHORT }}-${{ env.GITHUB_SHA_SHORT }} - path: | - addons - LICENSE - retention-days: 2 - - release: - name: Release - if: github.ref_type == 'tag' - needs: compile - runs-on: ubuntu-latest - steps: - - name: Download artifacts - uses: actions/download-artifact@v5 - - - name: Find Assets - shell: bash - run: | - echo "artifact_1_11=$(find * -maxdepth 0 -type d -name '*1.11*')" >> $GITHUB_ENV - echo "artifact_1_12=$(find * -maxdepth 0 -type d -name '*1.12*')" >> $GITHUB_ENV - - - name: Archive Assets - run: | - zip -r ${{ env.artifact_1_11 }}.zip ${{ env.artifact_1_11 }} - zip -r ${{ env.artifact_1_12 }}.zip ${{ env.artifact_1_12 }} - - - name: Create Release - id: create_release - uses: actions/create-release@v1.1.4 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ github.ref_name }} - release_name: ${{ github.ref_name }} - draft: true - prerelease: false - - - name: Upload Asset 1.11 - uses: actions/upload-release-asset@v1.0.2 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ${{ env.artifact_1_11 }}.zip - asset_name: ${{ env.artifact_1_11 }}.zip - asset_content_type: application/zip - - - name: Upload Asset 1.12 - uses: actions/upload-release-asset@v1.0.2 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ${{ env.artifact_1_12 }}.zip - asset_name: ${{ env.artifact_1_12 }}.zip - asset_content_type: application/zip diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..8e1990a --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,98 @@ +name: CI + +on: [push, pull_request, workflow_dispatch] + +jobs: + build: + name: Build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v7 + + - name: Setup SourcePawn compiler + uses: rumblefrog/setup-sp@v1.3.1 + with: + version: "1.12.x" + github-token: ${{ secrets.GITHUB_TOKEN }} + + - name: Build sourcemod plugin + working-directory: addons/sourcemod/scripting + run: | + set -euo pipefail + mkdir -p ../plugins + spcomp -i include -o ../plugins/VIP_Core.smx VIP_Core.sp + + - name: Create package + run: | + set -euo pipefail + mkdir -p /tmp/package/addons/sourcemod/plugins + cp addons/sourcemod/plugins/*.smx /tmp/package/addons/sourcemod/plugins/ + cp -R addons/sourcemod/translations /tmp/package/addons/sourcemod/ + cp -R addons/sourcemod/data /tmp/package/addons/sourcemod/ + + - name: Upload build archive for test runners + uses: actions/upload-artifact@v7 + with: + name: ${{ runner.os }} + path: /tmp/package + + tag: + name: Tag + needs: build + if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v7 + + - name: Delete existing "latest" release and tag + run: | + set -euo pipefail + gh release delete latest --cleanup-tag --yes || true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - uses: rickstaa/action-create-tag@v1 + with: + tag: latest + github_token: ${{ secrets.GITHUB_TOKEN }} + + release: + name: Release + needs: [build, tag] + if: | + always() && + needs.build.result == 'success' && + (needs.tag.result == 'success' || needs.tag.result == 'skipped') && + (startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main') + runs-on: ubuntu-latest + steps: + - name: Download artifacts + uses: actions/download-artifact@v8 + with: + name: ${{ runner.os }} + path: artifacts + + - name: Versioning + run: | + set -euo pipefail + version="latest" + if [[ "${{ github.ref_type }}" == "tag" ]]; then + version="${GITHUB_REF_NAME}" + fi + echo "RELEASE_VERSION=$version" >> "$GITHUB_ENV" + + - name: Package + run: | + set -euo pipefail + cd artifacts + tar -czf "../${{ github.event.repository.name }}-${{ env.RELEASE_VERSION }}.tar.gz" . + cd .. + + - name: Release + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: "*.tar.gz" + tag: ${{ env.RELEASE_VERSION }} + file_glob: true + overwrite: true diff --git a/.gitignore b/.gitignore index 01c0c85..019ce2c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,3 @@ .vscode/ *.smx -.sourceknight plugins/ diff --git a/sourceknight.yaml b/sourceknight.yaml deleted file mode 100644 index 653f83f..0000000 --- a/sourceknight.yaml +++ /dev/null @@ -1,18 +0,0 @@ -project: - sourceknight: 0.3 - name: VIP_Core - - dependencies: - - name: sourcemod - type: tar - version: 1.12 - location: https://sm.alliedmods.net/smdrop/1.12/sourcemod-1.12.0-git7165-linux.tar.gz - unpack: - - source: /addons - dest: /addons - - root: / - output: /addons/sourcemod/plugins - - targets: - - VIP_Core