Repository navigation
Add scheme preview deploy workflow #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Scheme previews | |
| # Builds the current production site (main) at the root and hosts the four | |
| # redesign colour schemes under /preview/<scheme>/ so they can be compared side | |
| # by side. The live site at the root stays exactly as main produces it. | |
| on: | |
| push: | |
| branches: [redesign/previews] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: pages | |
| cancel-in-progress: false | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout main (root site) | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: main | |
| path: root | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| - name: Build root site (production, unchanged) | |
| working-directory: root | |
| run: | | |
| npm ci | |
| npm run build | |
| mkdir -p "$GITHUB_WORKSPACE/_site" | |
| cp -r dist/. "$GITHUB_WORKSPACE/_site/" | |
| - name: Build scheme previews | |
| run: | | |
| for s in cyan-ink ember light-editorial mono-lime; do | |
| rm -rf scheme | |
| git clone --depth 1 --branch "redesign/$s" \ | |
| "https://x-access-token:${{ github.token }}@github.com/${{ github.repository }}.git" scheme | |
| (cd scheme && npm ci && PREVIEW_BASE="/preview/$s/" npm run build) | |
| mkdir -p "$GITHUB_WORKSPACE/_site/preview/$s" | |
| cp -r scheme/dist/. "$GITHUB_WORKSPACE/_site/preview/$s/" | |
| done | |
| - uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: _site | |
| deploy: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - id: deployment | |
| uses: actions/deploy-pages@v4 |