-
Notifications
You must be signed in to change notification settings - Fork 72
109 lines (93 loc) · 5.08 KB
/
release.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
name: Publish Release
on:
push:
tags:
- '*'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Get branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/tags/})"
id: get_branch_name
- name: Set environment variables
run: |
git fetch --unshallow
echo "COMMIT=$(git rev-list --count HEAD)" >> $GITHUB_ENV
echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
SOURCEMOD_PATH=$GITHUB_WORKSPACE/addons/sourcemod
echo "SOURCEMOD_PATH=$SOURCEMOD_PATH" >> $GITHUB_ENV
echo "PLUGINS_PATH=$SOURCEMOD_PATH/plugins" >> $GITHUB_ENV
echo "GAMEDATA_PATH=$SOURCEMOD_PATH/gamedata" >> $GITHUB_ENV
echo "SCRIPTING_PATH=$SOURCEMOD_PATH/scripting" >> $GITHUB_ENV
echo "INCLUDE_PATH=$SOURCEMOD_PATH/scripting/include" >> $GITHUB_ENV
echo "TRANSLATIONS_PATH=$SOURCEMOD_PATH/translations" >> $GITHUB_ENV
if [[ ${{ github.ref }} == *"pre"* || ${{ github.ref }} == *"beta"* ]]; then
echo "PRE_RELEASE=true" >> $GITHUB_ENV
else
echo "PRE_RELEASE=false" >> $GITHUB_ENV
fi
- name: Setup SourcePawn Compiler 1.11
uses: rumblefrog/setup-sp@master
with:
version: "1.11"
- name: Fetch plugin dependencies
run: |
wget https://raw.githubusercontent.com/peace-maker/DHooks2/dynhooks/sourcemod_files/scripting/include/dhooks.inc -P $INCLUDE_PATH
wget https://raw.githubusercontent.com/Impact123/AutoExecConfig/development/autoexecconfig.inc -P $INCLUDE_PATH
wget https://raw.githubusercontent.com/c0rp3n/colorlib-sm/master/addons/sourcemod/scripting/include/colorlib.inc -P $INCLUDE_PATH
- name: Replace version with git commit number
run: |
sed -i "s/1.0.dev/1.0.dev${{ env.COMMIT }}-${{ env.SHORT_SHA }}-${{ steps.get_branch_name.outputs.branch }}/g" $SCRIPTING_PATH/surftimer/globals.sp
- name: Download EndTouchFix source and gamedata file
run: |
wget https://github.com/rumourA/End-Touch-Fix/raw/master/scripting/EndTouchFix.sp -P $SCRIPTING_PATH
wget https://github.com/rumourA/End-Touch-Fix/raw/master/gamedata/endtouch.games.txt -P $GAMEDATA_PATH
- name: Download SurfTimer Mapchooser source and translations file
run: |
wget https://github.com/surftimer/SurfTimer-Mapchooser/raw/master/addons/sourcemod/scripting/st-mapchooser.sp -P $SCRIPTING_PATH
wget https://github.com/surftimer/SurfTimer-Mapchooser/raw/master/addons/sourcemod/scripting/st-nominations.sp -P $SCRIPTING_PATH
wget https://github.com/surftimer/SurfTimer-Mapchooser/raw/master/addons/sourcemod/scripting/st-rockthevote.sp -P $SCRIPTING_PATH
wget https://github.com/surftimer/SurfTimer-Mapchooser/raw/master/addons/sourcemod/scripting/st-voteextend.sp -P $SCRIPTING_PATH
wget https://github.com/surftimer/SurfTimer-Mapchooser/raw/master/addons/sourcemod/translations/st-mapchooser.phrases.txt -P $TRANSLATIONS_PATH
wget https://github.com/surftimer/SurfTimer-Mapchooser/raw/master/addons/sourcemod/translations/st-nominations.phrases.txt -P $TRANSLATIONS_PATH
wget https://github.com/surftimer/SurfTimer-Mapchooser/raw/master/addons/sourcemod/translations/st-rockthevote.phrases.txt -P $TRANSLATIONS_PATH
wget https://github.com/surftimer/SurfTimer-Mapchooser/raw/master/addons/sourcemod/translations/st-voteextend.phrases.txt -P $TRANSLATIONS_PATH
- name: Compile plugins
run: |
mkdir -p $PLUGINS_PATH
for file in *.sp
do
echo -e "\nCompiling $file..."
spcomp -w234 -O2 -v2 -i $includePath -i $INCLUDE_PATH -o $PLUGINS_PATH/$file $file
done
working-directory: ${{ env.SCRIPTING_PATH }}
- name: Prepare package directory and compress files
run: |
rm -R addons/sourcemod/scripting
mkdir package
mv ./{addons,cfg,maps,scripts,sound,LICENSE,README.md} package
cd package
zip -9r $GITHUB_WORKSPACE/SurfTimer.${{ steps.get_branch_name.outputs.branch }}.${{ env.COMMIT }}.${{ env.SHORT_SHA }}.SM1.11.zip *
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
draft: false
prerelease: ${{ env.PRE_RELEASE }}
- name: Upload SurfTimer
id: upload-surftimer
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./SurfTimer.${{ steps.get_branch_name.outputs.branch }}.${{ env.COMMIT }}.${{ env.SHORT_SHA }}.SM1.11.zip
asset_name: SurfTimer.${{ steps.get_branch_name.outputs.branch }}.${{ env.COMMIT }}.${{ env.SHORT_SHA }}.SM1.11.zip
asset_content_type: aapplication/zip