Skip to content

Commit d3e055e

Browse files
committed
Github Actions
1 parent e572440 commit d3e055e

File tree

2 files changed

+75
-5
lines changed

2 files changed

+75
-5
lines changed

.github/workflows/main.yml

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
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

deploy.sh

+5-5
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ echo "Uploading to site..."
1818

1919
curl -H "Content-Type: multipart/form-data" -X POST \
2020
-F "key=$INF_DEPLOY_KEY" \
21-
-F "buildnum=$TRAVIS_BUILD_NUMBER" \
22-
-F "commithash=$TRAVIS_COMMIT" \
23-
-F "commitmsg=$TRAVIS_COMMIT_MESSAGE" \
24-
-F "branch=$TRAVIS_BRANCH" \
21+
-F "buildnum=$BUILD_NUMBER" \
22+
-F "commithash=$COMMIT_HASH" \
23+
-F "commitmsg=$COMMIT_MSG" \
24+
-F "branch=$GITHUB_REF_NAME" \
2525
-F "file=@influx.tar" \
26-
"$INF_DEPLOY_URL"
26+
"$INF_DEPLOY_SITE"
2727

2828
echo "Done!"

0 commit comments

Comments
 (0)