-
-
Notifications
You must be signed in to change notification settings - Fork 2
167 lines (162 loc) · 7.15 KB
/
merge.yaml
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
# SPDX-FileCopyrightText: © 2022–2024 Kevin Lu
# SPDX-Licence-Identifier: AGPL-3.0-or-later
name: Merge all data sources
on:
workflow_dispatch:
repository_dispatch:
types:
- update
jobs:
merge:
runs-on: ubuntu-latest
outputs:
status: ${{ steps.commit.outputs.status }}
steps:
- uses: actions/checkout@v4
with:
path: yaml-yugi
- uses: actions/checkout@v4
with:
repository: DawnbrandBots/yaml-yugipedia
path: yaml-yugipedia
- uses: actions/checkout@v4
with:
path: yaml-yugi-ko
repository: DawnbrandBots/yaml-yugi-ko
sparse-checkout: |
*.csv
sparse-checkout-cone-mode: false
- uses: actions/checkout@v4
with:
repository: DawnbrandBots/yaml-yugi-zh
path: yaml-yugi-zh
- uses: actions/checkout@v4
with:
repository: db-ygoresources-com/yugioh-card-history
path: yugioh-card-history
- uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: pip
cache-dependency-path: yaml-yugi/src/requirements.txt
- name: Setup dependencies
run: |
mkdir aggregate
curl -fsSLo aggregate/master-duel-raw.json https://dawnbrandbots.github.io/yaml-yugi/master-duel-raw.json
curl -fsSLo tcg.vector.json https://dawnbrandbots.github.io/yaml-yugi-limit-regulation/tcg/current.vector.json
curl -fsSLo ocg.vector.json https://dawnbrandbots.github.io/yaml-yugi-limit-regulation/ocg/current.vector.json
pip install -r yaml-yugi/src/requirements.txt
- name: Transform (series)
working-directory: yaml-yugi/data/series
run: python3 ../../src/main_archetypes.py ../../../yaml-yugipedia/wikitext/TCG_and_OCG_archetypes
- name: Transform (OCG+TCG)
working-directory: yaml-yugi/data/cards
run: |
git rm --ignore-unmatch *.json *.yaml
python3 ../../src/main_ocgtcg.py \
../../../yaml-yugipedia/wikitext/Duel_Monsters_cards \
--zh-CN ../../../yaml-yugi-zh/zh-CN \
--assignments ../../src/assignments/assignments.yaml \
--tcg ../../../tcg.vector.json \
--ocg ../../../ocg.vector.json \
--unreleased ../../../yaml-yugipedia/semantic-mediawiki/unreleased.csv \
--ko-official ../../../yaml-yugi-ko/_site/ocg.csv \
--ko-override ../../../yaml-yugi-ko/ocg-override.csv \
--ko-prerelease ../../../yaml-yugi-ko/ocg-prerelease.csv \
--master-duel ../../../aggregate/master-duel-raw.json \
--aggregate ../../../aggregate/cards.json
- name: Transform (Rush Duel)
working-directory: yaml-yugi/data/rush
run: |
git rm --ignore-unmatch *.json *.yaml
python3 ../../src/main_rush.py \
../../../yaml-yugipedia/wikitext/Rush_Duel_cards \
--ko-override ../../../yaml-yugi-ko/rush-override.csv \
--ko-prerelease ../../../yaml-yugi-ko/rush-prerelease.csv \
--ocg-aggregate ../../../aggregate/cards.json \
--aggregate ../../../aggregate/rush.json
- name: Transform (TCG Speed Duel Skills)
working-directory: yaml-yugi/data/tcg-speed-skill
run: |
git rm --ignore-unmatch *.json *.yaml
python3 ../../src/main_speed.py \
../../../yaml-yugipedia/wikitext/Skill_Cards \
--aggregate ../../../aggregate/skill.json
- id: commit
uses: DawnbrandBots/.github/actions/commit-push@main
with:
message: "Transform: ${{ github.run_number }} (${{ github.run_id }})"
working-directory: yaml-yugi
- if: steps.commit.outputs.status > 0
working-directory: yaml-yugi
run: gh workflow run validate-data.yaml
env:
GH_TOKEN: ${{ github.token }}
- name: Transform (Master Duel)
working-directory: yaml-yugi
run: python src/main_masterduel.py '../yaml-yugipedia/wikitext/Yu-Gi-Oh!_Master_Duel_cards' > ../aggregate/master-duel-raw.json
- if: steps.commit.outputs.status > 0
working-directory: yaml-yugi
name: Merge
run: |
sed -s '1i---' data/cards/*.yaml > ../aggregate/cards.yaml
sed -s '1i---' data/rush/*.yaml > ../aggregate/rush.yaml
- if: steps.commit.outputs.status > 0
uses: actions/setup-node@v4
with:
node-version-file: yaml-yugi/.node-version
cache: yarn
cache-dependency-path: yaml-yugi/yarn.lock
- if: steps.commit.outputs.status > 0
working-directory: yaml-yugi
run: yarn
- if: steps.commit.outputs.status > 0
working-directory: yaml-yugi
run: yarn --silent check-for-ygoresources-discrepancies ../yugioh-card-history ja > ../aggregate/discrepancy.ja.json || true
- if: steps.commit.outputs.status > 0
working-directory: yaml-yugi
run: yarn --silent check-for-ygoresources-discrepancies ../yugioh-card-history en > ../aggregate/discrepancy.en.json || true
- if: steps.commit.outputs.status > 0
working-directory: yaml-yugi
run: yarn --silent check-for-ygoresources-discrepancies ../yugioh-card-history de > ../aggregate/discrepancy.de.json || true
- if: steps.commit.outputs.status > 0
working-directory: yaml-yugi
run: yarn --silent check-for-ygoresources-discrepancies ../yugioh-card-history es > ../aggregate/discrepancy.es.json || true
- if: steps.commit.outputs.status > 0
working-directory: yaml-yugi
run: yarn --silent check-for-ygoresources-discrepancies ../yugioh-card-history fr > ../aggregate/discrepancy.fr.json || true
- if: steps.commit.outputs.status > 0
working-directory: yaml-yugi
run: yarn --silent check-for-ygoresources-discrepancies ../yugioh-card-history it > ../aggregate/discrepancy.it.json || true
- if: steps.commit.outputs.status > 0
working-directory: yaml-yugi
run: yarn --silent check-for-ygoresources-discrepancies ../yugioh-card-history pt > ../aggregate/discrepancy.pt.json || true
- if: steps.commit.outputs.status > 0
run: cp aggregate/* yaml-yugi/src/web
- if: steps.commit.outputs.status > 0
uses: actions/upload-pages-artifact@v3
with:
path: yaml-yugi/src/web
- if: steps.commit.outputs.status > 0
working-directory: yaml-yugi
name: Load (push)
env:
OPENSEARCH_URL: ${{ secrets.OS_URL }}
run: |
yarn load ../aggregate/cards.yaml yu-gi-oh_ocg-tcg
yarn load ../aggregate/rush.yaml yu-gi-oh_rush
deploy-pages:
needs: merge
if: needs.merge.outputs.status > 0 && !cancelled()
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
# Deploy to the github-pages environment
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- uses: actions/deploy-pages@v4
id: deployment