-
Notifications
You must be signed in to change notification settings - Fork 174
146 lines (129 loc) · 6.06 KB
/
build.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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
name: Status
on:
push:
branches:
- development
- master
jobs:
build:
name: Compile & Generate Zip/Tar Files
runs-on: ubuntu-22.04
env:
OUTPUT_PATH: output/get5
OUTPUT_SM_PATH: output/get5/addons/sourcemod
SM_JSON_INC_PATH: get5/dependencies/sm-json/addons/sourcemod/scripting/include
STEAMWORKS_URL: https://raw.githubusercontent.com/hexa-core-eu/SteamWorks/main/Pawn/includes/SteamWorks.inc
steps:
- uses: actions/checkout@v3
with:
path: 'get5'
submodules: true
- uses: rumblefrog/setup-sp@master
with:
version: '1.11.x'
- name: Get shorthand commit.
id: vars
run: |
sha_short=$(echo ${{ github.sha }} | cut -c1-7)
get5_version=$(cat get5/scripting/get5/version.sp | grep -Eo '#define PLUGIN_VERSION "[0-9]+\.[0-9]+\.[0-9]+' | sed 's/#define PLUGIN_VERSION "//')
echo "last_nightly=$(git describe --tags $(git rev-list --tags --max-count=1))" >> $GITHUB_ENV
echo "sha_short=${sha_short}" >> $GITHUB_ENV
echo "get5_version=${get5_version}" >> $GITHUB_ENV
echo "get5_version_no_dots=${get5_version//./}" >> $GITHUB_ENV
if [ ${{ github.ref }} == 'refs/heads/master' ]
then
echo "get5_build_filename=get5-v${get5_version}" >> $GITHUB_ENV
echo "get5_version_sp_tag=${get5_version}" >> $GITHUB_ENV
else
echo "get5_build_filename=get5-v${get5_version}-${sha_short}" >> $GITHUB_ENV
echo "get5_version_sp_tag=${get5_version}-${sha_short}" >> $GITHUB_ENV
fi
- run: |
wget $STEAMWORKS_URL -P steamworks
mkdir -p $OUTPUT_SM_PATH/plugins/disabled
sed -i -r "s#\#define PLUGIN_VERSION \"[0-9]+\.[0-9]+\.[0-9]+-[a-zA-Z]+#\#define PLUGIN_VERSION \"${{ env.get5_version_sp_tag }}#g" get5/scripting/get5/version.sp
cp -R get5/cfg $OUTPUT_PATH
cp -R get5/translations $OUTPUT_SM_PATH
cp -R get5/configs $OUTPUT_SM_PATH
cp -R get5/scripting $OUTPUT_SM_PATH
cp get5/README.md $OUTPUT_PATH
cp get5/LICENSE $OUTPUT_PATH
spcomp get5/scripting/get5.sp -i steamworks -i $SM_JSON_INC_PATH -o $OUTPUT_SM_PATH/plugins/get5.smx -E
spcomp get5/scripting/get5_apistats.sp -i steamworks -i $SM_JSON_INC_PATH -o $OUTPUT_SM_PATH/plugins/disabled/get5_apistats.smx -E
spcomp get5/scripting/get5_mysqlstats.sp -i steamworks -i $SM_JSON_INC_PATH -o $OUTPUT_SM_PATH/plugins/disabled/get5_mysqlstats.smx -E
mkdir -p artifacts
cd $OUTPUT_PATH/ && tar -zcvf ../../artifacts/${{ env.get5_build_filename }}.tar.gz * && cd ../../
cd $OUTPUT_PATH/ && zip -r ../../artifacts/${{ env.get5_build_filename }}.zip . && cd ../../
- name: Store Artifacts For Tagging Release Or Nightly
uses: actions/upload-artifact@v3
with:
name: ${{ env.get5_build_filename }}
path: artifacts
outputs:
get5-version: ${{ env.get5_version }}
get5-version-no-dots: ${{ env.get5_version_no_dots }}
sha-short: ${{ env.sha_short }}
filename: ${{ env.get5_build_filename }}
deploy-nightly:
needs: [ build ]
name: Upload And Create Nightly Tag
if: github.ref == 'refs/heads/development'
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: ${{ needs.build.outputs.filename }}
path: artifacts
- name: Generate changelog
id: changelog
uses: metcalfc/changelog-generator@v4.1.0
with:
myToken: ${{ secrets.GITHUB_TOKEN }}
- name: Tag And Attach Nightly Build
uses: ncipollo/release-action@v1.13.0
with:
token: "${{ secrets.GITHUB_TOKEN }}"
artifacts: "artifacts/${{ needs.build.outputs.filename }}.zip,artifacts/${{ needs.build.outputs.filename }}.tar.gz"
prerelease: true
draft: true
commit: "${{ github.sha }}"
tag: "v${{ needs.build.outputs.get5-version }}-${{ needs.build.outputs.sha-short }}"
name: "Nightly ${{ needs.build.outputs.get5-version }}-${{ needs.build.outputs.sha-short }}"
body: |
### :warning: Prereleases are not considered stable!
You should only use prerelease versions if you understand the implications or if you want to contribute to
testing and development. Prereleases are updated more frequently and only one prerelease is available for
download at any time.
Please see the [`CHANGELOG.md`](https://github.com/splewis/get5/blob/development/CHANGELOG.md#${{ needs.build.outputs.get5-version-no-dots }}) for details on changes.
Commits included in this release:
${{ steps.changelog.outputs.changelog }}
deploy-stable:
needs: [ build ]
name: Upload Artifacts and Draft Full Release.
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Generate changelog
id: changelog
uses: metcalfc/changelog-generator@v4.1.0
with:
myToken: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/download-artifact@v3
with:
name: ${{ needs.build.outputs.filename }}
path: artifacts
- name: Tag And Draft Release
uses: ncipollo/release-action@v1.13.0
with:
token: "${{ secrets.GITHUB_TOKEN }}"
artifacts: "artifacts/${{ needs.build.outputs.filename }}.zip,artifacts/${{ needs.build.outputs.filename }}.tar.gz"
draft: true
commit: "${{ github.sha }}"
tag: "v${{ needs.build.outputs.get5-version }}"
name: "Version ${{ needs.build.outputs.get5-version }}"
body: |
Please see the [`CHANGELOG.md`](https://github.com/splewis/get5/blob/master/CHANGELOG.md#${{ needs.build.outputs.get5-version-no-dots }}) for changes.
Commits included in this release:
${{ steps.changelog.outputs.changelog }}