Skip to content

Commit 5bf2957

Browse files
feat(ci): release tar gz
1 parent 1f6a078 commit 5bf2957

1 file changed

Lines changed: 75 additions & 8 deletions

File tree

.github/workflows/ci.yml

Lines changed: 75 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,20 @@ on:
33
push:
44
branches:
55
- master
6-
- '[0-9]+.[0-9]+-dev'
6+
- '[0-9]+.[0-9]+-dev*'
7+
tags:
8+
- '*'
79
pull_request:
810
branches:
911
- master
10-
- '[0-9]+.[0-9]+-dev'
12+
- '[0-9]+.[0-9]+-dev*'
13+
tags:
14+
- '*'
1115
jobs:
12-
test:
16+
build:
1317
strategy:
1418
matrix:
15-
os: [ubuntu-18.04, ubuntu-latest, windows-latest]
19+
os: [ubuntu-latest, windows-latest]
1620
include:
1721
- os: windows-latest
1822
os_short: win
@@ -21,10 +25,6 @@ jobs:
2125
os_short: linux
2226
compiler_cc: clang
2327
compiler_cxx: clang++
24-
- os: ubuntu-18.04
25-
os_short: linux
26-
compiler_cc: clang-8
27-
compiler_cxx: clang++-8
2828
fail-fast: false
2929
runs-on: ${{ matrix.os }}
3030
name: ${{ matrix.os_short }}-${{ matrix.compiler_cc }}
@@ -96,3 +96,70 @@ jobs:
9696
cd build
9797
python ../configure.py --enable-optimize --sdks=${{ join(fromJSON(env.SDKS)) }} --targets=${{ env.ARCH }} --mms-path=${{ env.DEPENDENCIES_ROOT }}/mmsource-${{ env.MMSOURCE_VERSION }} --hl2sdk-root=${{ env.DEPENDENCIES_ROOT }} --mysql-path=${{ env.DEPENDENCIES_ROOT }}/mysql-${{ env.MYSQL_VERSION }} --mysql64-path=${{ env.DEPENDENCIES_ROOT }}/mysql-${{ env.MYSQL_VERSION }}-x86_64
9898
ambuild
99+
100+
- name: Add GeoIP2 - Linux
101+
working-directory: sourcemod/build
102+
if: startsWith(runner.os, 'Linux') || startsWith(runner.os, 'macOS')
103+
run: |
104+
mkdir -p package/addons/sourcemod/configs/geoip
105+
cd package/addons/sourcemod/configs/geoip
106+
curl -L https://github.com/P3TERX/GeoLite.mmdb/raw/download/GeoLite2-City.mmdb -o GeoLite2-City.mmdb
107+
108+
- name: Add GeoIP2 - Windows
109+
working-directory: sourcemod/build
110+
if: startsWith(runner.os, 'Windows')
111+
run: |
112+
cd package/addons/sourcemod/configs/geoip
113+
curl -L https://github.com/P3TERX/GeoLite.mmdb/raw/download/GeoLite2-City.mmdb -o GeoLite2-City.mmdb
114+
115+
- name: Upload build archive for test runners
116+
uses: actions/upload-artifact@v3
117+
with:
118+
name: ${{ runner.os }}
119+
path: sourcemod/build/package
120+
121+
release:
122+
name: Release
123+
if: startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main'
124+
needs:
125+
- build
126+
runs-on: ubuntu-latest
127+
steps:
128+
- name: Download artifacts
129+
uses: actions/download-artifact@v3
130+
131+
- name: Versioning
132+
run: |
133+
version="latest"
134+
if [[ "${{ github.ref_type }}" == 'tag' ]]; then
135+
version=`echo $GITHUB_REF | sed "s/refs\/tags\///"`;
136+
fi
137+
echo "RELEASE_VERSION=$version" >> $GITHUB_ENV
138+
139+
- name: Package
140+
run: |
141+
ls -Rall
142+
if [ -d "./Linux/" ]; then
143+
cd ./Linux/
144+
tar -czf ../${{ github.event.repository.name }}-${{ env.RELEASE_VERSION }}-linux.tar.gz -T <(\ls -1)
145+
cd -
146+
fi
147+
if [ -d "./macOS/" ]; then
148+
cd ./macOS/
149+
tar -czf ../${{ github.event.repository.name }}-${{ env.RELEASE_VERSION }}-mac.tar.gz -T <(\ls -1)
150+
cd -
151+
fi
152+
if [ -d "./Windows/" ]; then
153+
cd ./Windows/
154+
tar -czf ../${{ github.event.repository.name }}-${{ env.RELEASE_VERSION }}-windows.tar.gz -T <(\ls -1)
155+
cd -
156+
fi
157+
158+
- name: Release
159+
uses: svenstaro/upload-release-action@v2
160+
with:
161+
repo_token: ${{ secrets.GITHUB_TOKEN }}
162+
file: '*.tar.gz'
163+
tag: ${{ env.RELEASE_VERSION }}
164+
file_glob: true
165+
overwrite: true

0 commit comments

Comments
 (0)