-
Notifications
You must be signed in to change notification settings - Fork 5
90 lines (87 loc) · 4.33 KB
/
release.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
name: Auto Release that generates binary, and upload new layer version to AWS
on:
release:
types: [published]
jobs:
deploy:
runs-on: ubuntu-latest
strategy:
matrix:
aws-region: [ 'us-east-1', 'us-east-2', 'us-west-1', 'us-west-2', 'eu-central-1', 'eu-west-1', 'eu-north-1', 'ap-southeast-2', 'ca-central-1', 'sa-east-1', 'ap-northeast-1', 'ap-southeast-1', 'ap-south-1', 'ap-northeast-3', 'ap-northeast-2', 'eu-west-2', 'eu-west-3' ]
steps:
- uses: actions/checkout@v4
- name: Setup Go 1.22
uses: actions/setup-go@v5
with:
go-version: 1.22
- name: Setup AWS
id: setup-aws
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: ${{ matrix.aws-region }}
# AMD Build
- name: Build AMD ZIP File
id: build-amd-zip
working-directory: ./logzio-lambda-extensions-logs
run: |
chmod +x ./build-zip.sh
./build-zip.sh
- name: Publish AMD64 Layer Version
if: (steps.setup-aws.outcome == 'success' && steps.build-amd-zip.outcome == 'success')
id: publish-amd64
working-directory: ./logzio-lambda-extensions-logs/bin
run: |
AMD_LAYER_VERSION=$(aws lambda publish-layer-version \
--layer-name LogzioLambdaExtensionLogs \
--description "Extension for shipping Lambda logs to Logz.io ${{ github.event.release.tag_name }}." \
--zip-file "fileb://extension.zip" \
--region ${{ matrix.aws-region }} \
--compatible-runtimes dotnet8 python3.12 provided.al2023 dotnet6 java11 java17 java8.al2 nodejs16.x nodejs18.x python3.10 python3.11 python3.8 python3.9 ruby3.2 provided.al2 \
--compatible-architectures x86_64 \
--output text --query 'Version')
echo "AMD_LAYER_VERSION=$AMD_LAYER_VERSION" >> "$GITHUB_OUTPUT" # Save the version for next step
- name: Grant Public GetLayerVersion Permission for AMD64
if: (steps.setup-aws.outcome == 'success' && steps.publish-amd64.outcome == 'success')
working-directory: ./logzio-lambda-extensions-logs/bin
run: |
aws lambda add-layer-version-permission \
--layer-name LogzioLambdaExtensionLogs \
--version-number ${{ steps.publish-amd64.outputs.AMD_LAYER_VERSION }} \
--statement-id public-access-statement \
--principal '*' \
--action lambda:GetLayerVersion \
--region ${{ matrix.aws-region }}
# ARM Build
- name: Build ARM ZIP File
id: build-arm-zip
working-directory: ./logzio-lambda-extensions-logs
run: |
chmod +x ./build-arm-zip.sh
./build-arm-zip.sh
- name: Publish ARM64 Layer Version
id: publish-arm64
if: (steps.setup-aws.outcome == 'success' && steps.build-arm-zip.outcome == 'success')
working-directory: ./logzio-lambda-extensions-logs/bin
run: |
ARM_LAYER_VERSION=$(aws lambda publish-layer-version \
--layer-name LogzioLambdaExtensionLogsArm \
--description "Extension for shipping Lambda logs to Logz.io ${{ github.event.release.tag_name }}, for arm64 architecture.." \
--zip-file "fileb://extension.zip" \
--region ${{ matrix.aws-region }} \
--compatible-runtimes dotnet8 python3.12 provided.al2023 dotnet6 java11 java17 java8.al2 nodejs16.x nodejs18.x python3.10 python3.11 python3.8 python3.9 ruby3.2 provided.al2 \
--compatible-architectures arm64 \
--output text --query 'Version')
echo "ARM_LAYER_VERSION=$ARM_LAYER_VERSION" >> "$GITHUB_OUTPUT" # Save the version for next step
- name: Grant Public GetLayerVersion Permission for ARM64
if: (steps.setup-aws.outcome == 'success' && steps.publish-arm64.outcome == 'success')
working-directory: ./logzio-lambda-extensions-logs/bin
run: |
aws lambda add-layer-version-permission \
--layer-name LogzioLambdaExtensionLogsArm \
--version-number ${{ steps.publish-arm64.outputs.ARM_LAYER_VERSION }} \
--statement-id public-access-statement \
--principal '*' \
--action lambda:GetLayerVersion \
--region ${{ matrix.aws-region }}