-
Notifications
You must be signed in to change notification settings - Fork 2
73 lines (63 loc) · 2.51 KB
/
redeploy-lambdas.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
66
67
68
69
70
71
72
73
name: Rebuild and Redeploy Lambda Functions
on:
push:
branches:
- main
workflow_dispatch:
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Set up environment to detect changes
id: changes
run: |
echo "CHANGED_IMPORT=false" >> $GITHUB_ENV
echo "CHANGED_SYNC=false" >> $GITHUB_ENV
echo "CHANGED_NOTIFICATION=false" >> $GITHUB_ENV
if [[ $(git diff --name-only HEAD^ HEAD | grep -E 'src/import|src/shared') ]]; then
echo "CHANGED_IMPORT=true" >> $GITHUB_ENV
fi
if [[ $(git diff --name-only HEAD^ HEAD | grep -E 'src/sync|src/shared') ]]; then
echo "CHANGED_SYNC=true" >> $GITHUB_ENV
fi
if [[ $(git diff --name-only HEAD^ HEAD | grep -E 'src/notification_triggered|src/shared') ]]; then
echo "CHANGED_NOTIFICATION=true" >> $GITHUB_ENV
fi
- name: Install Rust
if: env.CHANGED_IMPORT == 'true' || env.CHANGED_SYNC == 'true' || env.CHANGED_NOTIFICATION == 'true'
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- name: Install Cargo Lambda with pip3
if: env.CHANGED_IMPORT == 'true' || env.CHANGED_SYNC == 'true' || env.CHANGED_NOTIFICATION == 'true'
run: |
pip3 install cargo-lambda
- name: Configure AWS credentials
if: env.CHANGED_IMPORT == 'true' || env.CHANGED_SYNC == 'true' || env.CHANGED_NOTIFICATION == 'true'
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- name: Build and deploy Import Lambda function
if: env.CHANGED_IMPORT == 'true'
run: |
cd src/import
cargo lambda build --release
cargo lambda deploy gh-import-issues --region us-east-1 --enable-function-url > /dev/null 2>&1;
- name: Build and deploy Sync Lambda function
if: env.CHANGED_SYNC == 'true'
run: |
cd src/sync
cargo lambda build --release
cargo lambda deploy gh-sync-repositories --region us-east-1 --enable-function-url > /dev/null 2>&1;
- name: Build and deploy Notification Lambda function
if: env.CHANGED_NOTIFICATION == 'true'
run: |
cd src/notification_triggered
cargo lambda build --release
cargo lambda deploy gh-notification-triggered --region eu-west-1