Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add workflow to deploy custom dev stack #623

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 70 additions & 0 deletions .github/workflows/deploy-custom-stack.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Deploy Custom Dev Stack for Pull Request

on:
pull_request:
branches:
- main # Trigger when there's a PR targeting the main branch

permissions:
id-token: write
contents: read

env:
AWS_REGION: eu-west-2

jobs:
setup:
runs-on: ubuntu-latest
outputs:
environments: "DEV" # Directly set environments output to "DEV"
steps:
- id: set-output
run: |
echo "::set-output name=environments::DEV" # Output only "DEV"

deploy-dev:
name: Deploy Custom DEV Stack for PR
runs-on: ubuntu-latest
needs: setup
steps:
- name: Check out repository code
uses: actions/checkout@v4

- name: Setup SAM CLI
uses: aws-actions/setup-sam@v2
with:
use-installer: true

- name: Assume temporary AWS role for DEV
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets[format('{0}_F2F_DDB_GH_ACTIONS_ROLE_ARN', needs.setup.outputs.environments) ] }}
aws-region: ${{ env.AWS_REGION }}

- name: SAM Validate
run: sam validate --region ${{ env.AWS_REGION }} -t template.yaml
working-directory: ./deploy

- name: SAM Build
run: sam build -t template.yaml
working-directory: ./deploy

- name: Deploy Custom Stack to DEV
env:
S3_BUCKET: ${{ secrets.DEV_CRI_F2F_ARTIFACT_SOURCE_BUCKET_NAME }}
run: |
sam deploy \
--resolve-s3 \
--stack-name "${GITHUB_HEAD_REF}" \
--s3-prefix "${GITHUB_HEAD_REF}" \
--confirm-changeset \
--config-env dev \
--parameter-overrides \
CodeSigningConfigArn="none" \
Environment="dev" \
PermissionsBoundary="none" \
SecretPrefix="none" \
VpcStackName="vpc-cri" \
L2DynamoStackName="f2f-cri-ddb" \
L2KMSStackName="f2f-cri-kms"
working-directory: ./deploy
Loading