-
Notifications
You must be signed in to change notification settings - Fork 2
93 lines (90 loc) · 4.32 KB
/
manual-site-build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
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 }}