Gatsby Publish #36
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: Gatsby Publish | |
on: | |
push: | |
branches: | |
- main | |
run-name: Gatsby Publish | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Install Yarn | |
run: npm install -g yarn | |
- name: Cache Dependencies | |
uses: actions/cache@v3 | |
id: cache | |
with: | |
path: node_modules | |
key: ${{ runner.OS }}-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.OS }}- | |
- name: Install Dependencies | |
if: ${{ steps.cache.outputs.cache-hit != 'true' }} | |
run: yarn install --prod | |
- name: Gatsby Build | |
run: yarn build | |
env: | |
PREFIX_PATHS: 'true' | |
- name: Upload Pages Artifact | |
uses: actions/upload-pages-artifact@v2 | |
with: | |
path: ./public | |
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@v3 |