forked from IMAP-Science-Operations-Center/sds-data-manager
-
Notifications
You must be signed in to change notification settings - Fork 0
65 lines (57 loc) · 1.98 KB
/
Copy pathdeploy.yml
File metadata and controls
65 lines (57 loc) · 1.98 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
name: Deploy
on:
push:
branches:
- dev
- prod
jobs:
cdk-deploy:
runs-on: ubuntu-latest
# These permissions are needed to interact with GitHub's OIDC Token endpoint.
permissions:
id-token: write
contents: read
steps:
- name: Set deployment account and role
id: set_account
run: |
if [[ "${GITHUB_REF##*/}" == "dev" ]]; then
echo "account_name=dev" >> $GITHUB_ENV
echo "role_arn=arn:aws:iam::449431850278:role/GitHubDeploy" >> $GITHUB_ENV
elif [[ "${GITHUB_REF##*/}" == "prod" ]]; then
echo "account_name=prod" >> $GITHUB_ENV
echo "role_arn=arn:aws:iam::593025701104:role/GitHubDeploy" >> $GITHUB_ENV
else
echo "Branch not configured for deployment." && exit 1
fi
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- uses: Gr1N/setup-poetry@v8
with:
poetry-version: "1.8.0"
- name: Install dependencies and app
run: |
poetry install --with layer-database --with layer-spice --with layer-processing
- name: Install cdk
run: |
npm install -g aws-cdk
# https://github.com/aws-actions/configure-aws-credentials
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ env.role_arn }}
aws-region: us-west-2
- name: Synth
env:
ACCOUNT_NAME: ${{ env.account_name }}
run: |
# poetry run to get the environment we installed everything into
poetry run cdk synth --context account_name=$ACCOUNT_NAME
- name: Deploy
env:
ACCOUNT_NAME: ${{ env.account_name }}
run: |
# poetry run to get the environment we installed everything into
poetry run cdk deploy --all --context account_name=$ACCOUNT_NAME --require-approval never