-
Notifications
You must be signed in to change notification settings - Fork 2
78 lines (65 loc) · 2.02 KB
/
deploy_ac_sync_lambda.yaml
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
66
67
68
69
70
71
72
73
74
75
76
77
78
name: Deploy Lambda Active Campaign Syncer
on:
push:
branches:
- "main"
paths:
- "packages/active-campaign-client/**"
- ".github/workflows/deploy_ac_sync_lambda.yaml"
workflow_dispatch:
inputs:
environment:
description: 'Choose environment'
type: choice
required: true
default: dev
options:
- dev
- prod
jobs:
build:
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: '20.x'
- name: Install dependencies
run: npm install
- name: Build
working-directory: packages/active-campaign-client
run: npm run build
- name: Package
working-directory: packages/active-campaign-client/dist
run: zip -r function.zip .
- name: Archive build artifacts
uses: actions/upload-artifact@v3
with:
name: active-campaign-client
path: packages/active-campaign-client/dist/function.zip
deploy:
name: Deploy Lambda Active Campaign Syncer
runs-on: ubuntu-22.04
needs: build
environment: ${{ github.event.inputs.environment || 'dev' }}
permissions:
id-token: write
contents: read
steps:
- name: Download build artifacts
uses: actions/download-artifact@v3
with:
name: active-campaign-client
path: ./packages/active-campaign-client/target
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: ${{ secrets.DEPLOY_IAM_ROLE }}
aws-region: eu-south-1
- name: Deploy Lambda function (${{ github.event.inputs.environment || 'dev' }})
run: |
aws lambda update-function-code \
--function-name ac-${{ github.event.inputs.environment || 'dev' }}-sync-lambda \
--zip-file fileb://packages/active-campaign-client/target/function.zip