ci: add GitHub Action to automatically build and deploy to GitHub Pages #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: Build GitHub Pages | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
name: Build and Publish | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
steps: | |
- name: Setup Node.js environment | |
uses: actions/setup-node@v3.9.1 | |
with: | |
node-version: 20.x | |
- name: Setup pnpm | |
uses: pnpm/action-setup@v4.1.0 | |
with: | |
# Version of pnpm to install | |
version: latest | |
- name: Install Dependencies | |
run: pnpm install | |
- name: Upload Artefact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: dist/ | |
deploy: | |
needs: build | |
permissions: | |
pages: write | |
id-token: write | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |