-
Notifications
You must be signed in to change notification settings - Fork 0
146 lines (128 loc) · 4.51 KB
/
release.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
name: Upload new release
on:
release:
types: [published]
permissions:
contents: write
jobs:
build_functions:
name: Build function
runs-on: ubuntu-latest
steps:
# Check out the repository to the runner
- name: Check out the repo
uses: actions/checkout@v4
# Fetch all history for all tags and branches
- run: git fetch --prune --unshallow
# Setup Go environment
- uses: actions/setup-go@v5
with:
go-version: '1.22.2'
# Import GPG key for GoReleaser
- name: Import GPG key
id: import_gpg
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.PASSPHRASE }}
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
version: latest
args: release --clean
env:
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Build CloudFormation Lambda function
run: |
cd cfn-lambda
cp -R ../common ./common
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o bootstrap .
zip -x "*_test.go" -r ../cfn-lambda.zip .
cd ..
- name: Build and Zip EventBridge Lambda function with common dependencies
run: |
cd eventbridge-lambda
cp -R ../common ./common
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o bootstrap .
zip -x "*_test.go" -r ../eventbridge-lambda.zip .
cd ..
- name: Upload Lambdas ZIP as Artifact
uses: actions/upload-artifact@v4
with:
name: lambdas
path: |
cfn-lambda.zip
eventbridge-lambda.zip
- name: Cleanup common folders
run: |
rm -rf cfn-lambda/common
rm -rf eventbridge-lambda/common
# Upload built artifacts to S3
upload_to_buckets:
name: Upload to S3 buckets
runs-on: ubuntu-latest
needs: build_functions
strategy:
matrix:
aws_region:
- 'us-east-1'
- 'us-east-2'
- 'us-west-1'
- 'us-west-2'
- 'eu-central-1'
- 'eu-central-2'
- 'eu-north-1'
- 'eu-west-1'
- 'eu-west-2'
- 'eu-west-3'
- 'eu-south-1'
- 'eu-south-2'
- 'sa-east-1'
- 'ap-northeast-1'
- 'ap-northeast-2'
- 'ap-northeast-3'
- 'ap-south-1'
- 'ap-south-2'
- 'ap-southeast-1'
- 'ap-southeast-2'
- 'ap-southeast-3'
- 'ap-southeast-4'
- 'ap-east-1'
- 'ca-central-1'
- 'ca-west-1'
- 'af-south-1'
- 'me-south-1'
- 'me-central-1'
- 'il-central-1'
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Download Artifact for Lambdas
uses: actions/download-artifact@v4
with:
name: lambdas
path: .
- name: Configure AWS CLI
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_KEY }}
aws-region: ${{ matrix.aws_region }}
- name: Upload CloudFormation Lambda ZIP to S3
run: |
aws s3 cp ./cfn-lambda.zip s3://logzio-aws-integrations-${{ matrix.aws_region }}/firehose-logs/${{ github.event.release.tag_name }}/cfn-lambda.zip --acl public-read
- name: Upload EventBridge Lambda ZIP to S3
run: |
aws s3 cp ./eventbridge-lambda.zip s3://logzio-aws-integrations-${{ matrix.aws_region }}/firehose-logs/${{ github.event.release.tag_name }}/eventbridge-lambda.zip --acl public-read
- name: Prepare SAM Template
run: |
cp ./cloudformation/sam-template.yaml ./sam-template-${{ matrix.aws_region }}.yaml
sed -i "s/<<VERSION>>/${{ github.event.release.tag_name }}/" "./sam-template-${{ matrix.aws_region }}.yaml"
sed -i "s/<<REGION>>/${{ matrix.aws_region }}/" "./sam-template-${{ matrix.aws_region }}.yaml"
- name: Upload SAM Template to S3
run: |
aws s3 cp ./sam-template-${{ matrix.aws_region }}.yaml s3://logzio-aws-integrations-${{ matrix.aws_region }}/firehose-logs/${{ github.event.release.tag_name }}/sam-template.yaml --acl public-read
- name: Clean
run: |
rm ./sam-template-${{ matrix.aws_region }}.yaml