Skip to content

Deploy main to prod

Deploy main to prod #1

Workflow file for this run

name: Deploy
# Need to set a default value for when the workflow is triggered from a git push,
# which bypasses the default configuration for inputs and cannot use env.ENVIRONMENT
# since env context is not accessible in this context
run-name: Deploy ${{ github.ref_name }} to ${{ inputs.environment || 'dev' }}
on:
# !! Uncomment the following lines once you've set up the dev environment and ready to turn on continuous deployment
# push:
# branches:
# - 'main'
# paths:
# - 'frontend/**'
# - 'bin/**'
# - 'infra/**'
workflow_dispatch:
inputs:
environment:
description: "target environment"
required: true
default: "dev"
type: choice
options:
- dev
- prod
env:
APP_NAME: frontend
# Need to set a default value for when the workflow is triggered from a git push,
# which bypasses the default configuration for inputs
ENVIRONMENT: ${{ inputs.environment || 'dev' }}
# Need to repeat the expression since env.ENVIRONMENT is not accessible in this context
concurrency: cd-${{ inputs.environment || 'dev' }}
jobs:
# Don't need to call the build-and-publish workflow since the database-migrations
# workflow already calls it
database-migrations:
name: Database migrations
uses: ./.github/workflows/database-migrations.yml
with:
environment: ${{ inputs.environment || 'dev' }}
deploy:
name: Deploy
runs-on: ubuntu-latest
needs: [database-migrations]
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v3
- name: Configure AWS credentials
uses: ./.github/actions/configure-aws-credentials
with:
app_name: ${{ env.APP_NAME }}
environment: ${{ env.ENVIRONMENT }}
- name: Deploy release
run: make release-deploy APP_NAME=$APP_NAME ENVIRONMENT="$ENVIRONMENT"