Repository navigation
105 lines (100 loc) · 3.66 KB
/
Copy pathdeploy.yml
File metadata and controls
105 lines (100 loc) · 3.66 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
name: Deploy
on:
push:
branches:
- main
workflow_dispatch:
permissions:
contents: read
concurrency:
group: pages
cancel-in-progress: false
jobs:
build:
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
permissions:
contents: read
pages: read
actions: read
steps:
- name: Checkout
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
with:
persist-credentials: false
- name: Read public app source
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
with:
repository: badger/home
ref: main
path: .catalog-source
persist-credentials: false
sparse-checkout-cone-mode: false
sparse-checkout: |
/badge/apps/*/README.md
/badge/apps/*/readme.md
- name: Setup Node.js
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: 22
cache: npm
- name: Install dependencies
run: npm ci
- name: Configure Pages
id: pages
uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5
- name: Verify Doom runtime and shareware assets
run: npm run verify:doom-assets -- --require
- name: Generate app catalog and descriptions
run: npm run sync:app-catalog -- .catalog-source
- name: Check app metadata
run: npm run test:app-descriptions && npm run test:app-catalog
- name: Build and verify site URLs
run: |
npm run build
node scripts/verify-site-paths.mjs "$BASE_PATH" "$SITE_URL"
env:
SITE_URL: ${{ github.repository == 'badger/badger.github.io' && 'https://badger.github.io' || steps.pages.outputs.origin }}
BASE_PATH: ${{ steps.pages.outputs.base_path }}
- name: Preserve assets for cached pages
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
run: |
if ! previous_runs=$(gh run list --workflow deploy.yml --branch main --status success --limit 2 --json databaseId --jq '.[].databaseId'); then
echo "::warning::Could not list previous deployments. Deploying current assets only."
previous_runs=''
fi
previous_directories=()
for run_id in $previous_runs; do
archive_directory=".previous-pages/$run_id"
mkdir -p "$archive_directory/site"
if ! gh run download "$run_id" --name github-pages --dir "$archive_directory"; then
echo "::warning::Pages artifact for run $run_id is unavailable or expired. Skipping historical assets."
continue
fi
if ! tar -xf "$archive_directory/artifact.tar" -C "$archive_directory/site"; then
echo "::warning::Pages artifact for run $run_id could not be extracted. Skipping historical assets."
continue
fi
previous_directories+=("$archive_directory/site")
done
node scripts/preserve-page-assets.mjs dist "${previous_directories[@]}"
- name: Upload artifact
uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3
with:
path: dist
retention-days: 30
deploy:
needs: build
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4