forked from MaaXYZ/MaaJsonViewer
-
Notifications
You must be signed in to change notification settings - Fork 0
128 lines (110 loc) · 3.2 KB
/
ci.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
name: ci
on:
push:
tags:
- 'v*'
branches:
- main # Set a branch name to trigger deployment
pull_request:
jobs:
meta:
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.set_tag.outputs.tag }}
steps:
- uses: actions/checkout@v3
- id: set_tag
run: |
echo tag=$(git describe --tags --match "v*" ${{ github.ref }} || git rev-parse --short HEAD) | tee -a $GITHUB_OUTPUT
build:
needs: meta
runs-on: ubuntu-22.04
permissions:
contents: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
steps:
- uses: actions/checkout@v3
with:
submodules: true # Fetch Hugo themes (true OR recursive)
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod
- name: Use Node.js 18
uses: actions/setup-node@v3
with:
node-version: 18
- name: Build
run: |
npm ci
npm run build
- name: Prepare MaaFramework
run: |
cd packages/server
wget https://github.com/MaaAssistantArknights/MaaFramework/releases/download/v0.3.5/MAA-win-x86_64-v0.3.5.zip -O maa.zip
mkdir maaframework
cd maaframework
unzip ../maa.zip
rm -r docs
rm -r include
rm -r lib
mv share/MaaAgentBinary .
rm -r share
cd ../../..
- name: Prepare Model
run: |
cd packages/server
mkdir -p maaframework/model
wget https://github.com/MaaAssistantArknights/MAA1999/releases/download/v0.3.2/MAA1999-win-x64-v0.3.2.zip -O maa1999.zip
mkdir 1999
cd 1999
unzip ../maa1999.zip
cd ..
cp -r ./1999/resource/model/* maaframework/model/
cd ../..
- name: Build Package
run: |
cd packages/server
echo '{}' > test.json
zip res.zip test.json
npx pkg . -t node18-x64-windows
mkdir -p out/library
mkdir -p out/saves
mkdir -p out/web
cp assets/config.json out/
mv maaframework out/library/
cp assets/controller_config.json out/library/maaframework/
cp -r web/* out/web/
cp -r res.zip out/saves/
cd ../..
- uses: actions/upload-artifact@v3
with:
name: MaaJsonViewer-win
path: 'packages/server/out'
- name: Clean for env
run: |
cd packages/server
rm -r out/library/maaframework/bin
rm -r out/web
rm out/server.exe
- uses: actions/upload-artifact@v3
with:
name: MaaJsonViewer-env
path: 'packages/server/out'
release:
if: startsWith(github.ref, 'refs/tags/v')
needs: [meta, build]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/download-artifact@v3
with:
path: assets
- run: |
cd assets
for f in *; do
(cd $f && zip -r ../$f-${{ needs.meta.outputs.tag }}.zip .)
done
- uses: softprops/action-gh-release@v1
with:
files: assets/*.zip
tag_name: ${{ needs.meta.outputs.tag }}