Skip to content

v1.20.0

v1.20.0 #88

name: Production Site Build
# Performs a Website release using Netlify when a new GitHub release has been published
on:
release:
types: [published]
workflow_dispatch:
inputs: {}
# schedule:
# - cron: '00 7 * * *' # 7am UTC = midnight PDT, 11pm PST # If enabled add a different time for FTVA
jobs:
nuxt-prod:
name: Netlify deploy
runs-on: ubuntu-latest
# timeout-minutes: 40
steps:
# Initial checkout to fetch repository content and tags
- uses: actions/checkout@v3
if: ${{ github.event_name != 'release' }}
with:
fetch-depth: 0 # Fetch all history for all tags and branches
# Determine the latest tag; this step will be skipped for direct release triggers
- name: Get Latest Tag
if: ${{ github.event_name != 'release' }}
id: latesttag
run: echo "LATEST_TAG=$(git describe --tags `git rev-list --tags --max-count=1`)" >> $GITHUB_ENV
# Conditionally checkout the latest tag for non-release events
- name: Checkout Latest Tag
if: ${{ github.event_name != 'release' }}
uses: actions/checkout@v3
with:
ref: ${{ env.LATEST_TAG }}
# For release events, GitHub Actions automatically checks out the commit of the release.
# Additional steps remain unchanged.
- name: Checkout code
uses: actions/checkout@v3
if: ${{ github.event_name == 'release' }}
# Corrected indentation here
- uses: ./.github/workflows/setup-workspace
- name: Cache built static site
id: cache-nuxt3
uses: actions/cache@v3
with:
path: .output/public
key: nuxt3-site-${{ github.sha }}
- run: pnpm run generate
env:
CRAFT_ENDPOINT: ${{ secrets.CRAFT_PROD_ENDPOINT }}
S3_BUCKET: "https://static.library.ucla.edu/"
SITEMAP_HOST: "https://ftva.library.ucla.edu"
ES_URL: ${{ secrets.ES_URL }}
ES_READ_KEY: ${{ secrets.ES_READ_KEY_PROD }}
ES_WRITE_KEY: ${{ secrets.ES_WRITE_KEY_PROD }}
ES_ALIAS: ${{ secrets.ES_ALIAS_PROD }}
ES_INDEX_PREFIX: ${{ 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: ${{ secrets.NETLIFY_PROD_FTVA_SITE_ID }}