Merge pull request #699 from PRX/move-spire-templates #30
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 Spire CD pipeline CloudFormation stack | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- spire/cd/template.yml | |
- spire/cd/src/** | |
concurrency: | |
group: ${{ github.workflow }} | |
jobs: | |
deploy_us_east_1: | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
contents: read | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: "3.9" | |
- uses: aws-actions/setup-sam@v2 | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v2 | |
with: | |
aws-region: us-east-1 | |
role-to-assume: arn:aws:iam::561178107736:role/DevOps-GitHubOidcFederatedRole | |
role-session-name: GitHubActions-DeployPlatformCdPipelineStack | |
- name: Deploy CloudFormation stack | |
working-directory: spire/cd | |
run: | | |
region="us-east-1" | |
bucket_name=$(aws cloudformation describe-stacks --region "$region" --stack-name aws-sam-cli-managed-default | jq -r ".Stacks[0].Outputs[0].OutputValue") | |
stack_name="infrastructure-cd" | |
sam build | |
sam deploy --region "$region" --no-confirm-changeset --no-fail-on-empty-changeset --stack-name "$stack_name" --s3-bucket "$bucket_name" --s3-prefix "$stack_name" --capabilities CAPABILITY_IAM | |
deploy_us_west_2: | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
contents: read | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: "3.9" | |
- uses: aws-actions/setup-sam@v2 | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v2 | |
with: | |
aws-region: us-west-2 | |
role-to-assume: arn:aws:iam::561178107736:role/DevOps-GitHubOidcFederatedRole | |
role-session-name: GitHubActions-DeployPlatformCdPipelineStack | |
- name: Deploy CloudFormation stack | |
working-directory: spire/cd | |
run: | | |
region="us-west-2" | |
bucket_name=$(aws cloudformation describe-stacks --region "$region" --stack-name aws-sam-cli-managed-default | jq -r ".Stacks[0].Outputs[0].OutputValue") | |
stack_name="infrastructure-cd" | |
sam build | |
sam deploy --region "$region" --no-confirm-changeset --no-fail-on-empty-changeset --stack-name "$stack_name" --s3-bucket "$bucket_name" --s3-prefix "$stack_name" --capabilities CAPABILITY_IAM |