-
Notifications
You must be signed in to change notification settings - Fork 0
101 lines (87 loc) · 2.85 KB
/
atlas.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
name: Atlas Parser
on:
workflow_dispatch:
repository_dispatch:
jobs:
atlas:
runs-on: ubuntu-latest
env:
output_dir: "data/"
cache_dir: "cache/"
mc_user: ${{ secrets.MC_USER }}
mc_pwd: ${{ secrets.MC_PWD }}
fandom_user: ${{ secrets.FANDOM_USER }}
fandom_pwd: ${{ secrets.FANDOM_PWD }}
discord_webhook: ${{ secrets.DISCORD_WEBHOOK }}
steps:
- name: Get Date
id: get-date
run: |
/bin/date
echo "date=$(/bin/date -u "+%Y%m%d%H%M")" >> $GITHUB_OUTPUT
curl -s https://ipinfo.io/ip
shell: bash
- uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
repository: chaldea-center/fgo-game-data-api
path: fgo-game-data-api
- name: Configure git author
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
- name: Save payload
if: ${{ github.event.client_payload }}
run: |
echo '${{ toJson(github.event.client_payload) }}' >> payload.json
cat payload.json
- name: Cache Atlas and wiki api response
uses: actions/cache@v4
with:
path: ${{ env.cache_dir }}
fail-on-cache-miss: true
save-always: true
key: api-cache-${{ runner.os }}-${{ steps.get-date.outputs.date }}
restore-keys: |
api-cache-${{ runner.os }}-
api-cache-
- name: Setup Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: "pip"
- name: Install dependencies
run: |
mv fgo-game-data-api/app app
rm -rf fgo-game-data-api
pip install -r requirements.txt
npm --location=global install js-beautify
- name: Checkout data repo
uses: actions/checkout@v4
with:
repository: chaldea-center/chaldea-data
token: ${{ secrets.GH_PAGES_TOKEN }}
path: ${{ env.output_dir }}
fetch-depth: 3
- name: Try parsing wiki
run: python main.py trywiki
- name: Commit wiki update
working-directory: ${{ env.output_dir }}
run: |
git add .
git --no-pager diff --stat --staged
git commit -m "update wiki data" || echo "Nothing to commit"
- name: Parse atlas
run: python main.py atlas
- name: Publish data
working-directory: ${{ env.output_dir }}
run: |
git add .
git --no-pager diff --stat --staged
if [ -e commit-msg.txt ]
then
git commit -F commit-msg.txt || echo "Nothing to commit"
else
git commit -m "atlas parser: update data" || echo "Nothing to commit"
fi
git push