|
| 1 | +name: CI/CD |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ master, dev ] |
| 6 | + pull_request: |
| 7 | + branches: [ master, dev ] |
| 8 | + |
| 9 | + workflow_dispatch: |
| 10 | + |
| 11 | +jobs: |
| 12 | + build: |
| 13 | + name: Build |
| 14 | + runs-on: ubuntu-latest |
| 15 | + env: |
| 16 | + BUILD_NUMBER: ${{ github.run_number }} |
| 17 | + |
| 18 | + steps: |
| 19 | + - name: Checkout |
| 20 | + uses: actions/checkout@v2 |
| 21 | + |
| 22 | + - name: Download SM & add it to PATH |
| 23 | + run: | |
| 24 | + wget "https://sourcemod.net/latest.php?os=linux&version=1.10" -O /tmp/sourcemod.tar.gz |
| 25 | + mkdir ~/sm && cd ~/sm |
| 26 | + tar xzf /tmp/sourcemod.tar.gz addons/sourcemod/scripting |
| 27 | + echo "$PWD/addons/sourcemod/scripting" >> $GITHUB_PATH |
| 28 | +
|
| 29 | + - name: Download & install SM Builder |
| 30 | + run: | |
| 31 | + git clone "https://github.com/TotallyMehis/sm-builder" ~/sm-builder |
| 32 | + cd ~/sm-builder |
| 33 | + pip install --user -r requirements.txt |
| 34 | + python setup.py install --prefix=~/.local |
| 35 | +
|
| 36 | + - name: Generate autoversion.inc |
| 37 | + run: python generate_auto_version.py build-$BUILD_NUMBER |
| 38 | + |
| 39 | + - name: Build plugins |
| 40 | + run: smbuilder --flags " -i=addons/sourcemod/scripting/include" |
| 41 | + |
| 42 | + - name: Upload artifact |
| 43 | + uses: actions/upload-artifact@v3 |
| 44 | + with: |
| 45 | + name: artifact |
| 46 | + path: | |
| 47 | + builds/ |
| 48 | + deploy.sh |
| 49 | + remove_autoversion.py |
| 50 | +
|
| 51 | + deploy: |
| 52 | + name: Deploy |
| 53 | + runs-on: ubuntu-latest |
| 54 | + needs: build |
| 55 | + if: github.event_name == 'push' # Only deploy on push |
| 56 | + env: |
| 57 | + INF_DEPLOY_KEY: ${{ secrets.INF_DEPLOY_KEY }} |
| 58 | + INF_DEPLOY_SITE: ${{ secrets.INF_DEPLOY_SITE }} |
| 59 | + COMMIT_MSG: ${{ github.event.head_commit.message }} |
| 60 | + COMMIT_HASH: ${{ github.event.head_commit.id }} |
| 61 | + BUILD_NUMBER: ${{ github.run_number }} |
| 62 | + |
| 63 | + steps: |
| 64 | + - name: Download artifact |
| 65 | + uses: actions/download-artifact@v2 |
| 66 | + with: |
| 67 | + name: artifact |
| 68 | + |
| 69 | + - name: Run deploy script |
| 70 | + run: bash deploy.sh |
0 commit comments