Skip to content

Regenerate static site when craft data is updated. #4

Regenerate static site when craft data is updated.

Regenerate static site when craft data is updated. #4

Workflow file for this run

name: Regenerate static site when craft data is updated.
on:
workflow_dispatch:
inputs:
environment:
description: 'Environment(test/prod)'
required: true
type: choice
options:
- test
- prod
default: 'test'
concurrency:
group: deploy-${{ github.event.inputs.environment }}
cancel-in-progress: true
jobs:
nuxt-deploy:
name: Netlify deploy
runs-on: ubuntu-latest
# timeout-minutes: 40
steps:
- uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
- uses: ./.github/workflows/setup-workspace
- name: Cache built static site
uses: actions/cache@v3
id: cache-nuxt3
with:
path: .output/public
key: nuxt3-site-${{ github.sha }}
- run: pnpm run generate
env:
CRAFT_ENDPOINT: "${{ github.event.inputs.environment == 'test' && secrets.CRAFT_ENDPOINT_TEST || secrets.CRAFT_PROD_ENDPOINT }}"
S3_BUCKET: "https://static.library.ucla.edu/"
SITEMAP_HOST: "${{ github.event.inputs.environment == 'test' && 'https://test-ftva.library.ucla.edu' || 'https://ftva.library.ucla.edu' }}"
ES_URL: ${{ secrets.ES_URL }}
ES_READ_KEY: "${{ github.event.inputs.environment == 'test' && secrets.ES_READ_KEY_TEST || secrets.ES_READ_KEY_PROD }}"
ES_WRITE_KEY: "${{ github.event.inputs.environment == 'test' && secrets.ES_WRITE_KEY_TEST || secrets.ES_WRITE_KEY_PROD }}"
ES_ALIAS: "${{ github.event.inputs.environment == 'test' && secrets.ES_ALIAS_TEST || secrets.ES_ALIAS_PROD }}"
ES_INDEX_PREFIX: "${{ github.event.inputs.environment == 'test' && secrets.ES_INDEX_PREFIX_TEST || secrets.ES_INDEX_PREFIX_PROD }}"
- name: Deploy to Netlify on release
uses: nwtgck/actions-netlify@v2 #
with:
production-deploy: true
deploy-message: https://github.com/UCLALibrary/ftva-website-nuxt/commit/${{ github.sha }}
github-token: ${{ secrets.GITHUB_TOKEN }}
publish-dir: .output/public
fails-without-credentials: true
github-deployment-environment: production
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: "${{ github.event.inputs.environment == 'test' && secrets.NETLIFY_TEST_FTVA_SITE_ID || secrets.NETLIFY_PROD_FTVA_SITE_ID }}"