Skip to content

Commit ce573ce

Browse files
committed
Add deploy to github pages.
1 parent 28ad4d5 commit ce573ce

File tree

1 file changed

+94
-0
lines changed

1 file changed

+94
-0
lines changed

.github/workflows/deploy-pages.yml

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
name: Deploy to GitHub Pages
2+
3+
on:
4+
# Run on pushes to the default branch
5+
push:
6+
branches:
7+
- main
8+
9+
# ... Also run manually
10+
workflow_dispatch:
11+
12+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
13+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
14+
concurrency:
15+
group: "pages"
16+
cancel-in-progress: false
17+
18+
# Default to bash
19+
defaults:
20+
run:
21+
shell: bash
22+
23+
jobs:
24+
# Build job
25+
build:
26+
runs-on: ubuntu-22.04
27+
timeout-minutes: 10
28+
permissions:
29+
contents: write
30+
pull-requests: read
31+
env:
32+
INPUT_PATH: "dist/"
33+
steps:
34+
- name: Checkout
35+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
36+
37+
- name: Set up Node.js
38+
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8
39+
with:
40+
node-version: "18.19.x"
41+
42+
- name: Install dependencies
43+
run: yarn
44+
45+
- name: Build
46+
run: yarn build
47+
48+
- name: Fix permissions
49+
run: |
50+
chmod -c -R +rX "$INPUT_PATH" | while read line; do
51+
echo "::warning title=Invalid file permissions automatically fixed::$line"
52+
done
53+
54+
- name: Archive artifact
55+
shell: sh
56+
run: |
57+
echo ::group::Archive artifact
58+
tar \
59+
--dereference --hard-dereference \
60+
--directory "$INPUT_PATH" \
61+
-cvf "$RUNNER_TEMP/artifact.tar" \
62+
--exclude=.git \
63+
--exclude=.github \
64+
--exclude=*/node_modules/* \
65+
--exclude=node_modules/* \
66+
$(test -f ../.releaseignore && echo "--exclude-from=../.releaseignore") \
67+
.
68+
echo ::endgroup::
69+
env:
70+
INPUT_PATH: ${{ env.INPUT_PATH }}
71+
72+
- name: Upload artifact
73+
id: upload-artifact
74+
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3
75+
with:
76+
name: github-pages
77+
path: ${{ runner.temp }}/artifact.tar
78+
retention-days: 1
79+
if-no-files-found: error
80+
81+
deploy:
82+
needs: build
83+
runs-on: ubuntu-22.04
84+
timeout-minutes: 10
85+
permissions:
86+
pages: write # to deploy to Pages
87+
id-token: write # to verify the deployment originates from an appropriate source
88+
environment:
89+
name: github-pages
90+
url: ${{ steps.deployment.outputs.page_url }}
91+
steps:
92+
- name: Deploy to GitHub Pages
93+
id: deployment
94+
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e

0 commit comments

Comments
 (0)