deploy #17
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 | |
on: | |
workflow_dispatch: | |
inputs: | |
environment: | |
description: 'Select the deployment environment' | |
required: true | |
type: choice | |
options: | |
- production | |
- staging | |
VERSION_TAG: | |
description: 'Specify the version tag for deployment' | |
required: true | |
type: string | |
workflow_call: | |
inputs: | |
environment: | |
description: 'Select the deployment environment' | |
required: true | |
type: string | |
VERSION_TAG: | |
description: 'Specify the version tag for deployment' | |
required: true | |
type: string | |
jobs: | |
deploy: | |
runs-on: ubuntu-22.04 | |
environment: ${{ inputs.environment }} | |
env: | |
VERSION_TAG: ${{ inputs.VERSION_TAG }} | |
TERRATEAM_ENVIRONMENT: ${{ inputs.environment }} | |
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} | |
MATRIX_PASSWORD: ${{ secrets.MATRIX_PASSWORD }} | |
AWS_ACCOUNT_NUMBER: ${{ secrets.AWS_ACCOUNT_NUMBER }} | |
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }} | |
permissions: | |
contents: read | |
id-token: write | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup Flyctl | |
if: ${{ inputs.environment == 'production' }} | |
uses: superfly/flyctl-actions/setup-flyctl@master | |
- name: Configure AWS Credentials with OIDC | |
if: ${{ inputs.environment == 'staging' }} | |
uses: aws-actions/configure-aws-credentials@v2 | |
with: | |
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_NUMBER }}:role/terrateam | |
aws-region: ${{ secrets.AWS_DEFAULT_REGION }} | |
- name: Deploy to ECS | |
if: ${{ inputs.environment == 'staging' }} | |
run: ./scripts/deploy_ecs | |
- name: Deploy to Fly.io | |
if: ${{ inputs.environment == 'production' }} | |
run: ./scripts/deploy_flyio | |
- name: Notify Matrix | |
run: ./scripts/notify_matrix |