Stack #107
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: Stack | |
on: | |
workflow_dispatch: | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: "Setup yq" | |
uses: dcarbone/[email protected] | |
- name: "Configure AWS credentials" | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: ${{ secrets.AWS_REGION }} | |
mask-aws-account-id: true | |
- name: "Install Rust toolchain" | |
uses: dtolnay/rust-toolchain@stable | |
- name: "Set up cargo cache" | |
uses: Swatinem/rust-cache@v2 | |
- name: "Generate template" | |
run: cargo run --bin cfn_gen | |
- name: "SAM Deploy" | |
env: | |
AWS_REGION: ${{ secrets.AWS_REGION }} | |
SAM_CLI_TELEMETRY: 0 | |
run: | | |
parameters_json=$(yq -o=json '.' parameters.yml) | |
stack_name=$(jq -r '.stack_name' <<< $parameters_json) | |
bucket_name=$(jq -r '.bucket_name' <<< $parameters_json) | |
bucket_status=$(aws s3api head-bucket --bucket $bucket_name --region $AWS_REGION 2>&1) || true | |
if echo $bucket_status | grep -q 'Not Found'; then | |
echo "Please deploy out 'backing' and 'runtimes' first" | |
exit 1 | |
fi | |
sam package \ | |
--template-file template.yml \ | |
--output-template-file packaged-template.yml \ | |
--s3-bucket $bucket_name | |
sam deploy \ | |
--template-file packaged-template.yml \ | |
--stack-name $stack_name \ | |
--capabilities CAPABILITY_NAMED_IAM \ | |
--region $AWS_REGION \ | |
--s3-bucket $bucket_name \ | |
--no-fail-on-empty-changeset |