-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy-bot-commands-processing-lambda.yml
More file actions
70 lines (59 loc) · 2.15 KB
/
deploy-bot-commands-processing-lambda.yml
File metadata and controls
70 lines (59 loc) · 2.15 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
66
67
68
69
70
name: Deploy bot-commands-processing-lambda
on:
push:
branches:
- main
paths:
- 'bot-commands-processing-lambda/**'
- 'common-library/**'
- '.github/workflows/deploy-bot-commands-processing-lambda.yml'
jobs:
deploy:
name: Build and Deploy
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Java 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: 'gradle'
- name: Build JAR
working-directory: bot-commands-processing-lambda
run: ./gradlew shadowJar
- name: Configure AWS credentials
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: ${{ secrets.AWS_REGION }}
- name: Upload JAR to S3
run: |
aws s3 cp \
bot-commands-processing-lambda/build/libs/bot-commands-processing-lambda.jar \
s3://${{ secrets.LAMBDA_BUCKET }}/bot-commands-processing-lambda.jar
- name: Deploy to Lambda
run: |
aws lambda update-function-code \
--function-name aviation-telegram-bot-bot-commands-processing \
--s3-bucket ${{ secrets.LAMBDA_BUCKET }} \
--s3-key bot-commands-processing-lambda.jar
- name: Wait for Lambda Update
run: |
aws lambda wait function-updated \
--function-name aviation-telegram-bot-bot-commands-processing
- name: Publish Lambda Version
id: publish
run: |
VERSION=$(aws lambda publish-version \
--function-name aviation-telegram-bot-bot-commands-processing \
--query 'Version' --output text)
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Update Live Alias
run: |
aws lambda update-alias \
--function-name aviation-telegram-bot-bot-commands-processing \
--name live \
--function-version ${{ steps.publish.outputs.version }}