Skip to content

Commit a36ae67

Browse files
committed
feat: github actions
1 parent bf96f81 commit a36ae67

File tree

2 files changed

+108
-0
lines changed

2 files changed

+108
-0
lines changed

.github/workflows/build.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
6+
jobs:
7+
build-linux:
8+
runs-on: ubuntu-latest
9+
10+
strategy:
11+
matrix:
12+
arch: [x86_64, arm64]
13+
14+
outputs:
15+
bot-artifact: ${{ steps.upload.outputs.bot }}
16+
web-artifact: ${{ steps.upload.outputs.web }}
17+
18+
steps:
19+
- name: Checkout repository
20+
uses: actions/checkout@v3
21+
with:
22+
submodules: recursive
23+
24+
- name: Install dependencies
25+
run: |
26+
sudo apt-get update
27+
sudo apt-get install -y \
28+
build-essential cmake tar \
29+
libmysqlclient-dev zlib1g-dev \
30+
gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
31+
32+
- name: Configure project
33+
run: |
34+
mkdir -p build
35+
cd build
36+
if [ "${{ matrix.arch }}" = "arm64" ]; then
37+
cmake -DUSE_TLS=1 .. \
38+
-DCMAKE_SYSTEM_NAME=Linux \
39+
-DCMAKE_SYSTEM_PROCESSOR=aarch64 \
40+
-DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc \
41+
-DCMAKE_CXX_COMPILER=aarch64-linux-gnu-g++
42+
else
43+
cmake -DUSE_TLS=1 ..
44+
fi
45+
46+
- name: Build project
47+
run: |
48+
cd build
49+
make
50+
51+
- name: Generate Lua pages
52+
run: |
53+
cd build
54+
cmake --build . --target generate_lua_pages
55+
56+
- name: Archive bot
57+
run: |
58+
mkdir -p artifacts
59+
tar -czf artifacts/bot-${{ matrix.arch }}.tar.gz -C build/bot/bin .
60+
61+
- name: Archive web
62+
run: |
63+
tar -czf artifacts/web-${{ matrix.arch }}.tar.gz -C www .
64+
65+
- name: Upload artifacts
66+
id: upload
67+
uses: actions/upload-artifact@v4
68+
with:
69+
name: build-artifacts-${{ matrix.arch }}
70+
path: artifacts/

.github/workflows/release.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Release
2+
3+
on:
4+
workflow_run:
5+
workflows: ["Build"]
6+
types:
7+
- completed
8+
9+
jobs:
10+
release:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Download x86_64 artifacts
15+
uses: actions/download-artifact@v3
16+
with:
17+
name: build-artifacts-x86_64
18+
path: artifacts/x86_64
19+
20+
- name: Download arm64 artifacts
21+
uses: actions/download-artifact@v3
22+
with:
23+
name: build-artifacts-arm64
24+
path: artifacts/arm64
25+
26+
- name: Set release tag
27+
run: echo "TAG=$(date +'%Y%m%d%H%M%S')" >> $GITHUB_ENV
28+
29+
- name: Create GitHub Release
30+
uses: ncipollo/release-action@v1
31+
with:
32+
tag_name: ${{ env.TAG }}
33+
name: ${{ env.TAG }}
34+
files: |
35+
artifacts/x86_64/bot-x86_64.tar.gz
36+
artifacts/x86_64/web-x86_64.tar.gz
37+
artifacts/arm64/bot-arm64.tar.gz
38+
artifacts/arm64/web-arm64.tar.gz

0 commit comments

Comments
 (0)