This action deploys a Stack to AWS using the Cloud Development Kit (CDK).
This action should be used in conjunction with the Configure AWS Credentials action to assume a Role with appropriate CloudFormation acess and a Trust Policy allowing a runner to assume the Role via a GitHub OIDC Identity Provider.
Currently, the action supports:
- Deployment of branch-scoped Stacks, through the use of a Stack suffix
- Deployment of ephemeral Stacks, which are destroyed at the end of a Job.
Input | Type | Required | Default | Description |
---|---|---|---|---|
stack-pattern | string | yes | Regex matching the ID of the Stack to Deploy | |
ephemeral | boolean | no | false | Destroys the Stack at the end of the Job |
parameters | string | no | "" | CfnParameters of the form k1=v1 k2=v2 ... |
app-file | string | no | app.py | Path to the CDK App file |
Output | type | Description |
---|---|---|
stack-output | string | The JSON contents of all CDKOutputs defined in the Stack |
jobs:
perform-deployment:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v3
with:
role-to-assume: ${{ secrets.AWS_DEPLOYMENT_ROLE_ARN }}
aws-region: ${{ secrets.AWS_DEFAULT_REGION }}
role-session-name: GithubRunnerDeployment
- name: Deploy to AWS
id: deploy
uses: rivelinrobotics/deploy-aws-cdk-stack@v1
with:
app-file: ./aws/app.py
stack-id: MyCustomStack
ephemeral: true
parameters: >
Parameter1=Value1
Parameter2=Value2
Parameter3=Value3
- name: Access Stack Output
run: echo ${{ fromJSON(steps.deploy.outputs.stack-output).MyCustomValue }}