-
Notifications
You must be signed in to change notification settings - Fork 0
76 lines (65 loc) · 2.06 KB
/
Copy pathpages.yml
File metadata and controls
76 lines (65 loc) · 2.06 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
name: Deploy HUD to GitHub Pages
on:
push:
branches: ["main"]
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: true
jobs:
build-pages:
runs-on: ubuntu-latest
outputs:
pages_enabled: ${{ steps.pages_check.outputs.enabled }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build HUD bundle
run: |
mkdir -p _site
cp index.html styles.css app.js manifesto.html _site/
cp -r docs _site/docs
- name: Check Pages enablement
id: pages_check
env:
GH_TOKEN: ${{ github.token }}
run: |
set -e
code=$(curl -s -o /tmp/pages.json -w "%{http_code}" \
-H "Authorization: Bearer ${GH_TOKEN}" \
-H "Accept: application/vnd.github+json" \
"https://api.github.com/repos/${{ github.repository }}/pages")
if [ "$code" = "200" ]; then
echo "enabled=true" >> "$GITHUB_OUTPUT"
echo "Pages is enabled for this repository."
else
echo "enabled=false" >> "$GITHUB_OUTPUT"
echo "Pages is not enabled (HTTP $code). Skipping deployment steps."
fi
- name: Configure Pages
if: steps.pages_check.outputs.enabled == 'true'
uses: actions/configure-pages@v5
- name: Upload Pages artifact
if: steps.pages_check.outputs.enabled == 'true'
uses: actions/upload-pages-artifact@v3
with:
path: _site
- name: Pages disabled notice
if: steps.pages_check.outputs.enabled != 'true'
run: |
echo "GitHub Pages deployment skipped because Pages is not enabled for this repository."
deploy:
runs-on: ubuntu-latest
needs: build-pages
if: needs.build-pages.outputs.pages_enabled == 'true'
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4