Merge pull request #34 from Psycle/site #7
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: Build and Deploy Site and Docs | |
on: | |
push: | |
branches: ["site"] | |
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. | |
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. | |
concurrency: | |
group: "pages" | |
cancel-in-progress: false | |
jobs: | |
# Build job | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [22.x] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Pages | |
uses: actions/configure-pages@v5 | |
- name: Initialise Node ${{ matrix.node-version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: 'npm' | |
- name: Build Site and Amalgamate Docs | |
run: | | |
# Creds | |
git config --global user.name "github-actions" | |
git config --global user.email "[email protected]" | |
git fetch | |
# Build site | |
rm -rf site | |
mkdir -p site | |
npm install | |
npm run build-production | |
# Grab main:docs | |
rm -rf docs | |
git checkout origin/main -- library/docs | |
# Move docs site into site/docs | |
mv library/docs site | |
# Grab main:visualization-library | |
rm -rf visualization-docs | |
git checkout origin/main -- visualization-library/storybook-static | |
# Move visualization-library site into site/visualization-docs | |
mv visualization-library/storybook-static site | |
mv site/storybook-static site/visualization-docs | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: site/ | |
# Deployment job | |
deploy: | |
runs-on: ubuntu-latest | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
needs: build | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |