Repository navigation
87 lines (77 loc) · 2.46 KB
/
Copy pathdeploy.yml
File metadata and controls
87 lines (77 loc) · 2.46 KB
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
name: Deploy Content to GitHub Pages
on:
push:
branches:
- main
paths:
- 'scripts/**'
- 'DeadForgeAssets/**'
schedule:
- cron: '0 */6 * * *' # Run every 6 hours (at minute 0 of hours 0, 6, 12, 18)
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- name: Verify JSON integrity
run: bun run verify
- name: Check for violations
run: |
if [ -f "violations.json" ]; then
echo "::error::JSON schema violations found. See violations.json for details. GitHub will not deploy the changes."
cat violations.json
echo "violated=true" >> $GITHUB_OUTPUT
fi
- name: Download Images and Update Hashes
id: download
run: bun run predeploy
- name: Check for download failures
run: |
if [ -f "download_failures.txt" ]; then
echo "::error::Some images failed to download. See download_failures.txt for details. GitHub will deploy changes, but some assets may be missing."
cat download_failures.txt
echo "failed=true" >> $GITHUB_OUTPUT
fi
- name: Update README Asset Table
run: bun run scripts/update_readme_table.ts
env:
SERVICE_BOT_PAT: ${{ secrets.SERVICE_BOT_PAT }}
- name: Clean up
run: bun run scripts/clean_dir.ts
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
if: steps.download.outputs.violated != 'true'
with:
path: ./DeadForgeAssets
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
if: steps.download.outputs.violated != 'true'
- name: Check for failures
if: always() # Run even if previous steps fail
run: |
has_failures=0
if [ -f "download_failures.txt" ]; then
has_failures=1
fi
if [ -f "violations.json" ]; then
has_failures=1
fi
if [ "$has_failures" -eq 1 ]; then
exit 1
else
echo "All downloads and JSON validations were successful!"
fi