Merge pull request #145 from R1KO/dependabot/github_actions/actions/u… #123
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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@v6 | |
| - 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@v7 | |
| 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@v7 | |
| - 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/[email protected] | |
| 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/[email protected] | |
| 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/[email protected] | |
| 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 |