-
Notifications
You must be signed in to change notification settings - Fork 4.5k
126 lines (120 loc) · 3.91 KB
/
handbook.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
name: "Handbook"
on:
workflow_dispatch: ~
push:
paths:
- "src/handbook/**.tsx"
branches:
- "development"
- "unstable"
pull_request:
paths:
- "src/handbook/**.tsx"
types:
- opened
- synchronize
- reopened
jobs:
Lint-Code:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Extract branch name
shell: bash
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
id: extract_branch
- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: '17'
- name: Cache node modules
uses: actions/cache@v2
with:
path: |
~/.npm
~/.cache
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install dependencies
working-directory: src/handbook
run: npm install --force
- name: Run linter
working-directory: src/handbook
run: npm run lint
- run: git config --global user.name "github-actions"
- run: git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
- run: git stash
- run: git checkout ${{ steps.extract_branch.outputs.branch }} && git pull
- run: git stash pop || true
- name: Commit changes
if: ${{ github.event_name == 'push' }}
run: git add -u && git commit -m "Lint Code [skip actions]" || true
- name: Push changes
if: ${{ github.event_name == 'push' }}
run: git push --set-upstream --force origin ${{ steps.extract_branch.outputs.branch }}
Build-Handbook:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: '17'
- name: Cache node modules
uses: actions/cache@v2
with:
path: |
~/.npm
~/.cache
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install dependencies
working-directory: src/handbook
run: npm install --force
- name: Download Avatar Data
uses: suisei-cn/[email protected]
with:
url: https://api.grasscutter.io/static/avatars.csv
target: src/handbook/data/
- name: Download Command Data
uses: suisei-cn/[email protected]
with:
url: https://api.grasscutter.io/static/commands.json
target: src/handbook/data/
- name: Download Entity Data
uses: suisei-cn/[email protected]
with:
url: https://api.grasscutter.io/static/entities.csv
target: src/handbook/data/
- name: Download Item Data
uses: suisei-cn/[email protected]
with:
url: https://api.grasscutter.io/static/items.csv
target: src/handbook/data/
- name: Download Scene Data
uses: suisei-cn/[email protected]
with:
url: https://api.grasscutter.io/static/scenes.csv
target: src/handbook/data/
- name: Download Quest Data
uses: suisei-cn/[email protected]
with:
url: https://api.grasscutter.io/static/quests.csv
target: src/handbook/data/
- name: Download Main Quest Data
uses: suisei-cn/[email protected]
with:
url: https://api.grasscutter.io/static/mainquests.csv
target: src/handbook/data/
- name: Build handbook
working-directory: src/handbook
run: npm run build
- name: Upload build
uses: actions/upload-artifact@v3
with:
name: Handbook
path: src/handbook/dist/*.html