Skip to content

Commit 50a40e1

Browse files
authored
Merge pull request #1 from nini22P/ci
feat: add ci
2 parents ae950f4 + fa7edc8 commit 50a40e1

File tree

1 file changed

+106
-0
lines changed

1 file changed

+106
-0
lines changed

.github/workflows/ci.yml

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
name: CI
2+
on:
3+
push:
4+
branches:
5+
- main
6+
paths-ignore:
7+
- README.md
8+
pull_request:
9+
paths-ignore:
10+
- README.md
11+
12+
jobs:
13+
build-windows:
14+
name: Build Windows
15+
runs-on: windows-latest
16+
steps:
17+
- name: Clone repository
18+
uses: actions/checkout@v4
19+
- name: Set up Node
20+
uses: actions/setup-node@v4
21+
with:
22+
node-version: 22
23+
cache: 'npm'
24+
- name: Install dependencies
25+
run: npm install
26+
- name: Build
27+
run: npm run build:unpack
28+
- name: Download lib
29+
run: npm run download-lib
30+
- name: Create ZIP archive
31+
run: Compress-Archive -Path "dist/win-unpacked/*" -DestinationPath "dist/webgal-apk-build-tool-windows-x64.zip"
32+
- name: Upload artifact
33+
uses: actions/upload-artifact@v4
34+
with:
35+
name: webgal-apk-build-tool-windows-x64
36+
path: dist/webgal-apk-build-tool-windows-x64.zip
37+
38+
build-linux:
39+
name: Build Linux
40+
runs-on: ubuntu-latest
41+
steps:
42+
- name: Clone repository
43+
uses: actions/checkout@v4
44+
- name: Set up Node
45+
uses: actions/setup-node@v4
46+
with:
47+
node-version: 22
48+
cache: 'npm'
49+
- name: Install dependencies
50+
run: npm install
51+
- name: Build
52+
run: npm run build:unpack
53+
- name: Download lib
54+
run: npm run download-lib
55+
- name: Create ZIP archive
56+
run: zip -r dist/webgal-apk-build-tool-linux-x64.zip dist/linux-unpacked
57+
- name: Upload artifact
58+
uses: actions/upload-artifact@v4
59+
with:
60+
name: webgal-apk-build-tool-linux-x64
61+
path: dist/webgal-apk-build-tool-linux-x64.zip
62+
63+
release:
64+
name: Release
65+
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
66+
runs-on: ubuntu-latest
67+
needs:
68+
- build-windows
69+
- build-linux
70+
steps:
71+
- name: Checkout
72+
uses: actions/checkout@v4
73+
- name: Get version
74+
id: yq
75+
uses: mikefarah/yq@master
76+
with:
77+
cmd: yq -r .version package.json
78+
- name: Prepare tag name
79+
id: tag_name
80+
run: |
81+
VERSION="${{ steps.yq.outputs.result }}"
82+
TAG_NAME="v${VERSION}"
83+
echo "TAG_NAME=$TAG_NAME" >> "$GITHUB_OUTPUT"
84+
- name: Check tag
85+
uses: mukunku/tag-exists-action@v1.6.0
86+
id: check-tag
87+
with:
88+
tag: ${{ steps.tag_name.outputs.TAG_NAME }}
89+
- name: Download artifact
90+
if: steps.check-tag.outputs.exists == 'false'
91+
uses: actions/download-artifact@v4
92+
with:
93+
path: artifacts
94+
merge-multiple: true
95+
- name: Release
96+
if: steps.check-tag.outputs.exists == 'false'
97+
uses: softprops/action-gh-release@v2
98+
env:
99+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
100+
with:
101+
tag_name: ${{ steps.tag_name.outputs.TAG_NAME }}
102+
draft: false
103+
prerelease: false
104+
files: |
105+
artifacts/webgal-apk-build-tool-windows-x64.zip
106+
artifacts/webgal-apk-build-tool-linux-x64.zip

0 commit comments

Comments
 (0)