forked from aws-samples/amazon-sagemaker-drift-detection
-
Notifications
You must be signed in to change notification settings - Fork 1
67 lines (55 loc) · 1.87 KB
/
publish-template.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
name: Publish Template to S3
on:
push:
branches: [ main ]
jobs:
synth-and-publish:
runs-on: ubuntu-latest
environment:
name: aws # Target only the AWS environment to publish CFN templates
defaults:
run:
shell: bash
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Python environment
uses: actions/setup-python@v2
with:
python-version: "3.8"
architecture: "x64"
- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: "12"
architecture: "x64"
cache: npm
- name: Install Requirements
run: |
npm install -g aws-cdk # Install cdk
pip install --requirement requirements.txt
- name: Configure AWS credentials
id: creds
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
role-duration-seconds: 1200
- name: Synth Template
env:
BUCKET_NAME: ${{ secrets.BUCKET_NAME }}
BUCKET_PREFIX: ${{ secrets.BUCKET_PREFIX }}
run: cdk synth drift-service-catalog --path-metadata false -c drift:ArtifactBucket=$BUCKET_NAME -c drift:ArtifactBucketPrefix=$BUCKET_PREFIX > cloudformation/drift-service-catalog.yml
- name: Publish Assets to S3
env:
BUCKET_NAME: ${{ secrets.BUCKET_NAME }}
BUCKET_PREFIX: ${{ secrets.BUCKET_PREFIX }}
run: python infra/upload_assets.py
- name: Upload Template
uses: actions/upload-artifact@v2
with:
name: cdk-template
path: cdk.out/*.template.json
- name: Print Template
run: cat cloudformation/drift-service-catalog.yml