-
Notifications
You must be signed in to change notification settings - Fork 0
46 lines (37 loc) · 1.1 KB
/
feature-branch-build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
name: Feature branch build
on:
push:
branches:
- '**'
env:
DEFAULT_BRANCH: main
AWS_ACCOUNT: ${{ vars.AWS_ACCOUNT }}
AWS_DEPLOYMENT_REGION: ${{ vars.AWS_DEPLOYMENT_REGION }}
HOSTED_ZONE_ID: ${{ vars.HOSTED_ZONE_ID }}
jobs:
build_and_deploy:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- name: Checkout
id: checkout
uses: actions/checkout@v4
- name: Prepare variables
run: echo SAFE_SOURCE_NAME=$(echo "${{ github.ref_name }}" | sed -r 's/[/.@_]+/-/g') >> $GITHUB_ENV
- name: Install, type-check, lint
run: |
npm ci
npm run type-check
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: eu-west-1
role-to-assume: ${{ vars.AWS_AUTH_ROLE }}
- name: Deploy infrastructure
if: env.SAFE_SOURCE_NAME == env.DEFAULT_BRANCH
run: npm run deploy
- name: Diff infrastructure
if: env.SAFE_SOURCE_NAME != env.DEFAULT_BRANCH
run: npm run cdk-diff-stacks