Skip to content

Commit 976bb6d

Browse files
committed
Add scheme preview deploy workflow
1 parent b3485b9 commit 976bb6d

1 file changed

Lines changed: 66 additions & 0 deletions

File tree

‎.github/workflows/previews.yml‎

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Scheme previews
2+
3+
# Builds the current production site (main) at the root and hosts the four
4+
# redesign colour schemes under /preview/<scheme>/ so they can be compared side
5+
# by side. The live site at the root stays exactly as main produces it.
6+
7+
on:
8+
push:
9+
branches: [redesign/previews]
10+
workflow_dispatch:
11+
12+
permissions:
13+
contents: read
14+
pages: write
15+
id-token: write
16+
17+
concurrency:
18+
group: pages
19+
cancel-in-progress: false
20+
21+
jobs:
22+
build:
23+
runs-on: ubuntu-latest
24+
steps:
25+
- name: Checkout main (root site)
26+
uses: actions/checkout@v4
27+
with:
28+
ref: main
29+
path: root
30+
31+
- uses: actions/setup-node@v4
32+
with:
33+
node-version: 20
34+
35+
- name: Build root site (production, unchanged)
36+
working-directory: root
37+
run: |
38+
npm ci
39+
npm run build
40+
mkdir -p "$GITHUB_WORKSPACE/_site"
41+
cp -r dist/. "$GITHUB_WORKSPACE/_site/"
42+
43+
- name: Build scheme previews
44+
run: |
45+
for s in cyan-ink ember light-editorial mono-lime; do
46+
rm -rf scheme
47+
git clone --depth 1 --branch "redesign/$s" \
48+
"https://x-access-token:${{ github.token }}@github.com/${{ github.repository }}.git" scheme
49+
(cd scheme && npm ci && PREVIEW_BASE="/preview/$s/" npm run build)
50+
mkdir -p "$GITHUB_WORKSPACE/_site/preview/$s"
51+
cp -r scheme/dist/. "$GITHUB_WORKSPACE/_site/preview/$s/"
52+
done
53+
54+
- uses: actions/upload-pages-artifact@v3
55+
with:
56+
path: _site
57+
58+
deploy:
59+
needs: build
60+
runs-on: ubuntu-latest
61+
environment:
62+
name: github-pages
63+
url: ${{ steps.deployment.outputs.page_url }}
64+
steps:
65+
- id: deployment
66+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)