Repository navigation
Previews: drop terminal layout from build loop #3
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: Layout previews | |
| # Builds the current production site (main) at the root and hosts the four | |
| # redesign layout paradigms under /preview/<name>/ 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 layout previews | |
| run: | | |
| for name in spatial horizontal editorial; do | |
| rm -rf layout | |
| git clone --depth 1 --branch "redesign/layout-$name" \ | |
| "https://x-access-token:${{ github.token }}@github.com/${{ github.repository }}.git" layout | |
| (cd layout && npm ci && PREVIEW_BASE="/preview/$name/" npm run build) | |
| mkdir -p "$GITHUB_WORKSPACE/_site/preview/$name" | |
| cp -r layout/dist/. "$GITHUB_WORKSPACE/_site/preview/$name/" | |
| 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 |