diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..fdd49b9c --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,78 @@ +name: Compile + +on: [push, pull_request, workflow_dispatch] + +jobs: + compile: + runs-on: ubuntu-latest + strategy: + matrix: + sm-version: [ '1.10', '1.11', '1.12' ] + + name: "Build SM ${{ matrix.sm-version }}" + steps: + - name: Prepare env + shell: bash + run: echo "GITHUB_SHA_SHORT=${GITHUB_SHA::7}" >> $GITHUB_ENV + + - uses: actions/checkout@v3 + + - name: Setup SP + uses: rumblefrog/setup-sp@master + with: + version: ${{ matrix.sm-version }} + + - name: Download and extract dependencies + shell: bash + run: | + # Mac zip just because it's smaller & we don't repack the extensions... + wget https://github.com/ErikMinekus/sm-ripext/releases/download/1.3.1/sm-ripext-1.3.1-mac.zip + unzip sm-ripext-1.3.1-mac.zip "addons/sourcemod/scripting/include/*" + wget https://github.com/clugg/sm-json/archive/refs/tags/v4.1.1.tar.gz + tar --strip-components=1 -xvzf v4.1.1.tar.gz sm-json-4.1.1/addons/sourcemod/scripting/include + wget https://github.com/hermansimensen/eventqueue-fix/archive/refs/tags/1.3.1.tar.gz + tar --strip-components=1 -xvzf 1.3.1.tar.gz -C addons/sourcemod + rm -rf *.zip *.tar.gz addons/sourcemod/.git* addons/sourcemod/LICENSE + + - name: Run compiler + shell: bash + run: | + cd addons/sourcemod + mkdir plugins + for src in $(find scripting -maxdepth 1 -type f -name "*.sp"); + do + spcomp $src -o=plugins/$(basename $src .sp)'.smx' -i=scripting/include -v2 + done + + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: bhoptimer-${{ github.head_ref || github.ref_name }}-sm${{ matrix.sm-version }}-${{ env.GITHUB_SHA_SHORT }} + path: | + addons + materials + sound + CHANGELOG.md + LICENSE + README.md + retention-days: 14 + + release: + name: Release + if: github.ref_type == 'tag' + needs: compile + runs-on: ubuntu-latest + steps: + - name: Download artifacts + uses: actions/download-artifact@v3 + + - name: Archive artifacts + shell: bash + run: find * -maxdepth 0 -type d -exec zip -rq {}.zip {} \; + + - uses: ncipollo/release-action@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + draft: true + name: ${{ github.ref_name }} + artifacts: "*.zip" \ No newline at end of file