Deploy AWS SAM Resources (Reusable) #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 AWS SAM Resources | |
on: | |
workflow_dispatch: | |
inputs: | |
region: | |
description: 'AWS Region' | |
required: true | |
default: 'us-east-1' | |
environment: | |
type: choice | |
options: | |
- dev | |
- prd | |
description: 'Environment (dev or prd)' | |
required: true | |
default: 'dev' | |
env: | |
APP_ID: wbornor-splayshapi | |
AWS_REGION: us-east-1 | |
AWS_CICD_ROLE_ARN: arn:aws:iam::796019718156:role/splayshapi-cicd-DeployerRole-ReOfpb4FBtBc | |
AWS_SAM_EXECUTION_ROLE_ARN: arn:aws:iam::796019718156:role/splayshapi-cicd-CloudFormationExecutionRole-FjUNsyRX1Ixf | |
AWS_CICD_BUCKET: wbornor-splayshapi-deployment-bucket | |
jobs: | |
stack: | |
name: Deploy stack to AWS | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
contents: read | |
steps: | |
- name: Configure AWS credentials | |
id: creds | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
role-to-assume: ${{ env.AWS_CICD_ROLE_ARN }} | |
aws-region: ${{ env.AWS_REGION }} | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Setup Python | |
uses: actions/setup-python@v2 | |
- name: Setup SAM | |
uses: aws-actions/setup-sam@v2 | |
with: | |
use-installer: true | |
# sam build | |
- name: SAM Build | |
run: sam build --use-container | |
# sam deploy | |
- name: SAM Deploy | |
run: | | |
sam deploy \ | |
--no-confirm-changeset \ | |
--no-fail-on-empty-changeset \ | |
--stack-name "$APP_ID-${{ github.event.inputs.environment }}" \ | |
--role-arn "$AWS_SAM_EXECUTION_ROLE_ARN" \ | |
--s3-bucket "$AWS_CICD_BUCKET" \ | |
--capabilities CAPABILITY_IAM \ | |
--region "$AWS_REGION" | |
# - name: Deploy splayshapi aws resources | |
# id: splayshapi | |
# uses: aws-actions/aws-cloudformation-github-deploy@master | |
# with: | |
# name: ${{ steps.env-name.outputs.environment }}-splayshapi | |
# template: "file:///infra/sam-pipeline.yml" | |
# no-fail-on-empty-changeset: "1" |