This file contains 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: Deploy to GitHub Pages | |
on: | |
push: | |
branches: [master] | |
paths: | |
- docs/** | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: node lts version check | |
run: | | |
node_ver="$(curl -sL https://nodejs.org/download/release/index.json | jq -r '[.[]|select(.lts)][0].version')" | |
printf '%s' "node_ver=${node_ver#v}" >> $GITHUB_ENV | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ env.node_ver }} | |
- name: Install dependencies | |
run: if [[ -d docs ]]; then cd docs && npm install; else exit 1; fi | |
- name: Build site | |
run: if [[ -d docs ]]; then cd docs && npm run build; else exit 1; fi | |
- name: Upload Pages artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
name: github-pages | |
path: ./docs/build/ | |
deploy: | |
needs: build | |
runs-on: ubuntu-latest | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |