Deploy Live AWS #1128
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: 'Deploy Live AWS' | |
on: | |
workflow_dispatch: | |
inputs: | |
logLevel: | |
description: 'Log level' | |
required: true | |
default: 'warning' | |
type: choice | |
options: | |
- info | |
- warning | |
- debug | |
environment: | |
description: 'Which environment to update.' | |
type: choice | |
default: 'dev' | |
required: true | |
options: | |
- dev | |
- prod | |
# Allows external webhook trigger | |
repository_dispatch: | |
types: | |
- webhook | |
env: | |
AWS_REGION: eu-central-1 | |
defaults: | |
run: | |
shell: bash | |
working-directory: src | |
permissions: | |
id-token: write # This is required for requesting the JWT | |
contents: read # This is required for actions/checkout | |
jobs: | |
deploy: | |
name: deploy ${{ inputs.environment }} | |
runs-on: ubuntu-22.04 | |
environment: ${{ inputs.environment }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@e1e17a757e536f70e52b5a12b2e8d1d1c60e04ef | |
with: | |
role-to-assume: ${{ secrets.IAM_ROLE }} | |
aws-region: ${{ env.AWS_REGION }} | |
- name: Use Node.js | |
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c | |
with: | |
node-version: 18 | |
- name: Build | |
env: | |
STRAPI_TOKEN: ${{ secrets.STRAPI_TOKEN }} | |
STRAPI_API_URL: ${{ vars.STRAPI_URL }} | |
GATSBY_UPDATE_SCHEMA_SNAPSHOT: ${{ vars.GATSBY_UPDATE_SCHEMA_SNAPSHOT }} | |
MAIN_MENU_IT: ${{ vars.MAIN_MENU_IT }} | |
MAIN_MENU_EN: ${{ vars.MAIN_MENU_EN }} | |
RESERVED_MENU_IT: ${{ vars.RESERVED_MENU_IT }} | |
RESERVED_MENU_EN: ${{ vars.RESERVED_MENU_EN }} | |
FOOTER_TOP_IT: ${{ vars.FOOTER_TOP_IT }} | |
FOOTER_TOP_EN: ${{ vars.FOOTER_TOP_EN }} | |
FOOTER_BOTTOM_IT: ${{ vars.FOOTER_BOTTOM_IT }} | |
FOOTER_BOTTOM_EN: ${{ vars.FOOTER_BOTTOM_EN }} | |
CDN_BASE_URL: ${{ vars.CDN_BASE_URL }} | |
CDN_MEDIA_DIR: ${{ vars.CDN_MEDIA_DIR }} | |
STRAPI_MEDIA_DIR: ${{ vars.STRAPI_MEDIA_DIR }} | |
run: | | |
yarn install | |
yarn build | |
- name: s3-publish | |
uses: jonelantha/gatsby-s3-action@6886fa8db9cb48761715caac380ee6861b00ed12 | |
with: | |
dest-s3-bucket: ${{ vars.AWS_BUCKET }} | |
cloudfront-id-to-invalidate: ${{ vars.AWS_CLOUDFRONT_ID }} | |
public-source-path: public |