Skip to content

Commit d77b900

Browse files
authored
Update GitHub Actions CI (#204)
* Add .amxx for CI build package; * Optimize work time; * FIX amxxpc output; * Remove WIP check for Pull Requests; * Only the latest ReAPI package (GitHub releases API); * Better release package compression (7z used); * Draft releases only PR merge; * Check labels optimize.
1 parent 3f74b7d commit d77b900

File tree

7 files changed

+170
-124
lines changed

7 files changed

+170
-124
lines changed

.github/release-drafter.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ categories:
1111
- "bugfix"
1212
- "bug"
1313
- title: "🧰 Maintenance"
14-
label: "chore"
14+
labels:
15+
- "maintenance"
1516
change-template: "- $TITLE @$AUTHOR (#$NUMBER)"
1617
change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks.
1718
version-resolver:

.github/workflows/CI.yml

Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [master]
6+
paths-ignore:
7+
- "**.md"
8+
9+
pull_request:
10+
types: [opened, reopened, synchronize]
11+
release:
12+
types: [published]
13+
14+
jobs:
15+
build:
16+
name: "Build"
17+
runs-on: ubuntu-latest
18+
outputs:
19+
sha: ${{ steps.declare_sha.outputs.sha }}
20+
semver: ${{ steps.declare_sha.outputs.semver }}
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v2
24+
with:
25+
fetch-depth: 0
26+
27+
- name: Parse SemVer string (release)
28+
id: semver_parser
29+
if: |
30+
github.event_name == 'release' &&
31+
github.event.action == 'published' &&
32+
startsWith(github.ref, 'refs/tags/')
33+
uses: booxmedialtd/ws-action-parse-semver@v1
34+
with:
35+
input_string: ${{ github.ref }}
36+
version_extractor_regex: '\/v(.*)$'
37+
38+
- name: Declare SHA & package name
39+
id: declare_sha
40+
shell: bash
41+
run: |
42+
SHA=$(git rev-parse --short HEAD)
43+
echo "COMMIT_SHA=${SHA}" >> $GITHUB_ENV
44+
echo "::set-output name=sha::$SHA"
45+
echo "::set-output name=semver::${{ steps.semver_parser.outputs.fullversion }}"
46+
47+
- name: Setup latest AMXModX
48+
env:
49+
AMXMODX_VERSION_MINOR: "1.9"
50+
run: |
51+
LAST_VERSION_NAME=$( \
52+
curl \
53+
--silent \
54+
https://www.amxmodx.org/amxxdrop/$AMXMODX_VERSION_MINOR/amxmodx-latest-base-linux \
55+
)
56+
57+
curl \
58+
--remote-name \
59+
--remote-header-name \
60+
https://www.amxmodx.org/amxxdrop/$AMXMODX_VERSION_MINOR/$LAST_VERSION_NAME
61+
62+
tar xzf *.tar.gz
63+
64+
- name: Setup latest ReAPI includes
65+
env:
66+
REPO: "s1lentq/reapi"
67+
run: |
68+
curl \
69+
--silent \
70+
https://api.github.com/repos/$REPO/releases/latest | \
71+
grep "browser_download_url" | \
72+
grep -Eo 'https://[^\"]*' | \
73+
xargs wget
74+
75+
7z x *.zip
76+
77+
- name: Clean compiler
78+
run: |
79+
mkdir -p compiler/compiled
80+
cp -Rf addons/amxmodx/scripting/* compiler/
81+
rm -rf compiler/*.sma
82+
rm -rf compiler/testsuite/
83+
84+
rm -rf addons/
85+
86+
- name: Update versions for plugins (release)
87+
if: |
88+
github.event_name == 'release' &&
89+
github.event.action == 'published' &&
90+
startsWith(github.ref, 'refs/tags/')
91+
env:
92+
PLUGIN_VERSION: "v${{ steps.semver_parser.outputs.fullversion }}"
93+
run: |
94+
cd cstrike/addons/amxmodx/scripting/include/
95+
sed -i "s|%CA_VERSION%|$PLUGIN_VERSION|g" ChatAdditions.inc
96+
97+
- name: Update versions for plugins
98+
env:
99+
PLUGIN_VERSION: "${{ env.COMMIT_SHA }}"
100+
run: |
101+
cd cstrike/addons/amxmodx/scripting/include/
102+
sed -i "s|%CA_VERSION%|$PLUGIN_VERSION|g" ChatAdditions.inc
103+
104+
- name: Build
105+
env:
106+
COMPILER_PATH: "compiler"
107+
run: |
108+
cp -Rf cstrike/addons/amxmodx/scripting/* compiler/
109+
cd compiler
110+
111+
for sourcefile in *.sma;
112+
do
113+
amxxfile="`echo $sourcefile | sed -e 's/\.sma$/.amxx/'`"
114+
echo -n "Compiling $sourcefile ..."
115+
./amxxpc $sourcefile -ocompiled/$amxxfile >> temp.txt
116+
echo "done"
117+
done
118+
119+
cat temp.txt
120+
rm temp.txt
121+
122+
- name: Move files
123+
run: |
124+
mkdir publish
125+
mv cstrike/ publish/
126+
mv compiler/compiled/ publish/cstrike/addons/amxmodx/plugins/
127+
128+
- name: Upload artifact
129+
uses: actions/upload-artifact@v2
130+
with:
131+
name: ChatAdditions-${{ env.COMMIT_SHA }}-dev
132+
path: publish/*
133+
134+
publish:
135+
name: "Publish"
136+
runs-on: ubuntu-latest
137+
needs: [build]
138+
if: |
139+
github.event_name == 'release' &&
140+
github.event.action == 'published' &&
141+
startsWith(github.ref, 'refs/tags/')
142+
steps:
143+
- name: Download artifacts
144+
uses: actions/download-artifact@v2
145+
with:
146+
name: ChatAdditions-${{needs.build.outputs.sha}}-dev
147+
148+
- name: Packaging binaries
149+
id: packaging
150+
run: 7z a -mm=Deflate -mfb=258 -mpass=15 -r ChatAdditions-v${{needs.build.outputs.semver}}.zip cstrike/
151+
152+
- name: Publish artifacts
153+
uses: softprops/action-gh-release@v1
154+
id: publish-job
155+
if: |
156+
startsWith(github.ref, 'refs/tags/') &&
157+
steps.packaging.outcome == 'success'
158+
env:
159+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
160+
with:
161+
files: |
162+
*.zip

.github/workflows/build.yml

Lines changed: 0 additions & 61 deletions
This file was deleted.
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
name: Release Drafter
22

33
on:
4-
push:
5-
branches:
6-
- master
74
pull_request:
8-
types: [opened, reopened, synchronize]
5+
types: [closed]
96

107
jobs:
118
update_release_draft:
129
runs-on: ubuntu-latest
10+
if: github.event.pull_request.merged == true
1311
steps:
1412
- uses: release-drafter/release-drafter@v5
13+
with:
14+
config-name: release-drafter.yml
1515
env:
1616
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/label_verifier.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ name: "Verify type labels"
22

33
on:
44
pull_request:
5-
types: [opened, labeled, unlabeled, synchronize]
5+
types: [labeled, unlabeled]
66

77
jobs:
88
triage:
99
runs-on: ubuntu-18.04
1010
steps:
1111
- uses: zwaldowski/match-label-action@v2
1212
with:
13-
allowed: "bug, feature, core plugin, gag plugin"
13+
allowed: "bug, fix, feature, maintenance"

.github/workflows/upload_release_asset.yml

Lines changed: 0 additions & 44 deletions
This file was deleted.

.github/workflows/wip_check.yml

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)