cicd-infra-prod #22
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: cicd-infra-prod | |
on: | |
push: | |
branches: [main] | |
paths: | |
- 'cloud/**' | |
workflow_dispatch: | |
jobs: | |
plan: | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
contents: read | |
steps: | |
- name: Git clone the repository | |
uses: actions/checkout@v3 | |
- name: Setup python for sam | |
uses: actions/setup-python@v3 | |
- name: Setup sam | |
uses: aws-actions/setup-sam@v2 | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
role-to-assume: arn:aws:iam::${{ secrets.AWS_PROD_ACCOUNT_ID }}:role/aws-identity-providers-federation-github-actions | |
role-session-name: github-actions-dev | |
aws-region: ap-northeast-1 | |
- name: Setup Terraform | |
uses: hashicorp/setup-terraform@v1 | |
- name: Terraform Init | |
run: terraform init | |
working-directory: ./cloud/terraform/environments/prod | |
- name: Terraform apply | |
run: terraform apply -auto-approve -var tetris_frontend_origin=${{ secrets.TETRIS_FRONT_ORIGIN_PROD }} -var tetris_ecr_repository=${{ secrets.TETRIS_ECR_REPOSITORY_PROD }} | |
working-directory: ./cloud/terraform/environments/prod | |
- name: Sam build | |
run: sam build --use-container | |
working-directory: ./cloud/sam | |
- name: Sam deploy | |
run: TETRIS_FRONT_ORIGIN=${{ secrets.TETRIS_FRONT_ORIGIN_PROD }} SQS_URL=${{ secrets.TETRIS_SQS_URL_PROD}} TETRIS_TRAINING_BUCKET_NAME=${{ secrets.TETRIS_TRAINING_BUCKET_NAME_PROD }} ENV=prod make deploy | |
working-directory: ./cloud/sam |