Manually rebuild and deploy static site #110
Workflow file for this run
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: Manually rebuild and deploy static site | |
on: | |
workflow_dispatch: | |
inputs: | |
environment: | |
description: Environment | |
required: true | |
type: choice | |
options: | |
- test | |
- stage | |
- prod | |
default: test | |
concurrency: | |
group: deploy-${{ github.event.inputs.environment }} | |
cancel-in-progress: true | |
jobs: | |
nuxt-deploy: | |
name: Static Generation build | |
runs-on: ubuntu-latest | |
# timeout-minutes: 50 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: ./.github/workflows/setup-workspace | |
- name: Cache built static site | |
uses: actions/cache@v3 | |
with: | |
path: .output/public | |
key: nuxt-site-${{ github.sha }} | |
- name: Sets env vars for test | |
run: | | |
echo "CRAFT_ENDPOINT=${{secrets.CRAFT_ENDPOINT}} " >> $GITHUB_ENV | |
echo "SITEMAP_HOST=${{secrets.SITEMAP_URL_TEST}}" >> $GITHUB_ENV | |
echo "NETLIFY_SITE_ID=${{secrets.NETLIFY_SITE_ID}}" >> $GITHUB_ENV | |
echo "ES_READ_KEY=${{secrets.ES_READ_KEY_TEST}}" >> $GITHUB_ENV | |
echo "ES_WRITE_KEY=${{secrets.ES_WRITE_KEY_TEST}}" >> $GITHUB_ENV | |
echo "ES_ALIAS=${{secrets.ES_ALIAS_TEST}}" >> $GITHUB_ENV | |
echo "ES_INDEX_PREFIX=${{secrets.ES_INDEX_PREFIX_TEST}}" >> $GITHUB_ENV | |
echo "LIBGUIDES_ES_INDEX=${{secrets.LIBGUIDES_ES_INDEX_TEST}}" >> $GITHUB_ENV | |
echo "ES_TEMP_INDEX_PREFIX_LIBGUIDES=${{secrets.ES_TEMP_INDEX_PREFIX_LIBGUIDES_TEST}}" >> $GITHUB_ENV | |
if: github.event.inputs.environment == 'test' | |
- name: Sets env vars for stage | |
run: | | |
echo "CRAFT_ENDPOINT=${{secrets.CRAFT_PROD_ENDPOINT}}" >> $GITHUB_ENV | |
echo "SITEMAP_HOST=${{secrets.SITEMAP_URL_STAGE}}" >> $GITHUB_ENV | |
echo "NETLIFY_SITE_ID=${{secrets.NETLIFY_STAGE_LIBRARY_SITE_ID}}" >> $GITHUB_ENV | |
echo "ES_READ_KEY=${{secrets.ES_READ_KEY_STAGE}}" >> $GITHUB_ENV | |
echo "ES_WRITE_KEY=${{secrets.ES_WRITE_KEY_STAGE}}" >> $GITHUB_ENV | |
echo "ES_ALIAS=${{secrets.ES_ALIAS_STAGE}}" >> $GITHUB_ENV | |
echo "ES_INDEX_PREFIX=${{secrets.ES_INDEX_PREFIX_STAGE}}" >> $GITHUB_ENV | |
echo "LIBGUIDES_ES_INDEX=${{secrets.LIBGUIDES_ES_INDEX_STAGE}}" >> $GITHUB_ENV | |
echo "ES_TEMP_INDEX_PREFIX_LIBGUIDES=${{secrets.ES_TEMP_INDEX_PREFIX_LIBGUIDES_STAGE}}" >> $GITHUB_ENV | |
if: github.event.inputs.environment == 'stage' | |
- name: Sets env vars for prod | |
run: | | |
echo "CRAFT_ENDPOINT=${{secrets.CRAFT_PROD_ENDPOINT}}" >> $GITHUB_ENV | |
echo "SITEMAP_HOST=${{secrets.SITEMAP_URL_PROD}}" >> $GITHUB_ENV | |
echo "NETLIFY_SITE_ID=${{secrets.NETLIFY_PROD_LIBRARY_SITE_ID}}" >> $GITHUB_ENV | |
echo "ES_READ_KEY=${{secrets.ES_READ_KEY_PROD}}" >> $GITHUB_ENV | |
echo "ES_WRITE_KEY=${{secrets.ES_WRITE_KEY_PROD}}" >> $GITHUB_ENV | |
echo "ES_ALIAS=${{secrets.ES_ALIAS_PROD}}" >> $GITHUB_ENV | |
echo "ES_INDEX_PREFIX=${{secrets.ES_INDEX_PREFIX_PROD}}" >> $GITHUB_ENV | |
echo "LIBGUIDES_ES_INDEX=${{secrets.LIBGUIDES_ES_INDEX_PROD}}" >> $GITHUB_ENV | |
echo "ES_TEMP_INDEX_PREFIX_LIBGUIDES=${{secrets.ES_TEMP_INDEX_PREFIX_LIBGUIDES_PROD}}" >> $GITHUB_ENV | |
if: github.event.inputs.environment == 'prod' | |
- run: pnpm run generate | |
env: | |
CRAFT_ENDPOINT: ${{env.CRAFT_ENDPOINT}} | |
S3_BUCKET: 'https://static.library.ucla.edu/' | |
SITEMAP_HOST: ${{env.SITEMAP_HOST}} | |
ES_URL: ${{ secrets.ES_URL }} | |
LIBCAL_ENDPOINT: ${{ secrets.LIBCAL_ENDPOINT }} | |
ES_READ_KEY: ${{env.ES_READ_KEY}} | |
ES_WRITE_KEY: ${{env.ES_WRITE_KEY}} | |
ES_ALIAS: ${{env.ES_ALIAS}} | |
ES_INDEX_PREFIX: ${{env.ES_INDEX_PREFIX}} | |
ES_TEMP_INDEX_PREFIX_LIBGUIDES: ${{env.ES_TEMP_INDEX_PREFIX_LIBGUIDES}} | |
LIBGUIDES_ES_INDEX: ${{env.LIBGUIDES_ES_INDEX}} | |
- name: Deploy to Netlify | |
uses: nwtgck/actions-netlify@v3 # | |
with: | |
production-deploy: true | |
deploy-message: https://github.com/UCLALibrary/library-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: ${{ env.NETLIFY_SITE_ID }} |