-
-
Notifications
You must be signed in to change notification settings - Fork 28
63 lines (57 loc) · 2.03 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
name: CI
on:
pull_request_target:
branches:
- dev
- alpha
push:
branches:
- dev
- alpha
workflow_dispatch:
inputs:
publish:
type: boolean
description: Publish to workshop
addon:
type: choice
description: Workshop addon
options:
- beta
- alpha
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Create gma file
run: |
wget -O /tmp/fastgmad.zip "https://github.com/WilliamVenner/fastgmad/releases/download/v0.2.0/fastgmad_linux.zip"
unzip /tmp/fastgmad.zip -d /tmp/fastgmad
chmod +x /tmp/fastgmad/fastgmad
mkdir -p /tmp/addon
/tmp/fastgmad/fastgmad create -folder . -out /tmp/addon/addon.gma
- name: Set workshop addon id
if: (github.event_name == 'push' && contains(fromJSON('["refs/heads/dev", "refs/heads/alpha"]'), github.ref)) || github.event.inputs.publish == 'true'
run: |
if [[ "${{ github.event.inputs.addon }}" == "beta" || "${{ github.ref }}" == "refs/heads/dev" ]]; then
WORKSHOP_ID=${{ vars.BETA_WORKSHOP_ID }}
elif [[ "${{ github.event.inputs.addon }}" == "alpha" || "${{ github.ref }}" == "refs/heads/alpha" ]]; then
WORKSHOP_ID=${{ vars.ALPHA_WORKSHOP_ID }}
else
echo "Unknown workshop ID" 1>&2
exit 1
fi
echo "Publishing to workshop ID $WORKSHOP_ID"
echo "WORKSHOP_ID=$WORKSHOP_ID" >> $GITHUB_ENV
- name: Publish to workshop
if: env.WORKSHOP_ID
run: |
docker run --rm \
-e STEAM_USER="${{ vars.STEAM_USERNAME }}" \
-e STEAM_PASSWORD="${{ secrets.STEAM_PASSWORD }}" \
--mount type=bind,source="/tmp/addon",target=/home/gmodws/upload \
aperturedevelopment/gmodws:latest \
upload ${{ env.WORKSHOP_ID }} addon.gma \
"${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }}"