forked from emqx/emqx
-
Notifications
You must be signed in to change notification settings - Fork 0
242 lines (234 loc) · 6.94 KB
/
build_packages.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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
name: Cross build packages
concurrency:
group: build-packages-${{ github.event_name }}-${{ github.ref }}
cancel-in-progress: true
on:
workflow_call:
inputs:
profile:
required: true
type: string
publish:
required: true
type: boolean
otp_vsn:
required: true
type: string
elixir_vsn:
required: true
type: string
builder_vsn:
required: true
type: string
secrets:
AWS_ACCESS_KEY_ID:
required: true
AWS_SECRET_ACCESS_KEY:
required: true
AWS_DEFAULT_REGION:
required: true
AWS_S3_BUCKET:
required: true
AWS_CLOUDFRONT_ID:
required: true
APPLE_ID_PASSWORD:
required: true
APPLE_DEVELOPER_IDENTITY:
required: true
APPLE_DEVELOPER_ID_BUNDLE:
required: true
APPLE_DEVELOPER_ID_BUNDLE_PASSWORD:
required: true
workflow_dispatch:
inputs:
ref:
required: false
profile:
required: true
default: 'emqx'
publish:
required: false
type: boolean
default: false
otp_vsn:
required: false
type: string
default: '26.2.1-2'
elixir_vsn:
required: false
type: string
default: '1.15.7'
builder_vsn:
required: false
type: string
default: '5.3-2'
permissions:
contents: read
jobs:
mac:
strategy:
fail-fast: false
matrix:
profile:
- ${{ inputs.profile }}
os:
- macos-12
- macos-12-arm64
- macos-13
otp:
- ${{ inputs.otp_vsn }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
with:
ref: ${{ github.event.inputs.ref }}
fetch-depth: 0
- uses: ./.github/actions/package-macos
with:
profile: ${{ matrix.profile }}
otp: ${{ matrix.otp }}
os: ${{ matrix.os }}
apple_id_password: ${{ secrets.APPLE_ID_PASSWORD }}
apple_developer_identity: ${{ secrets.APPLE_DEVELOPER_IDENTITY }}
apple_developer_id_bundle: ${{ secrets.APPLE_DEVELOPER_ID_BUNDLE }}
apple_developer_id_bundle_password: ${{ secrets.APPLE_DEVELOPER_ID_BUNDLE_PASSWORD }}
- uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
if: success()
with:
name: ${{ matrix.profile }}-${{ matrix.os }}-${{ matrix.otp }}
path: _packages/${{ matrix.profile }}/
retention-days: 7
linux:
runs-on: [self-hosted, ephemeral, linux, "${{ matrix.arch == 'arm64' && 'arm64' || 'x64' }}"]
strategy:
fail-fast: false
matrix:
profile:
- ${{ inputs.profile }}
os:
- ubuntu22.04
- ubuntu20.04
- ubuntu18.04
- debian12
- debian11
- debian10
- el9
- el8
- el7
- amzn2
- amzn2023
arch:
- amd64
- arm64
with_elixir:
- 'no'
otp:
- ${{ inputs.otp_vsn }}
builder:
- ${{ inputs.builder_vsn }}
elixir:
- ${{ inputs.elixir_vsn }}
include:
- profile: ${{ inputs.profile }}
os: ubuntu22.04
arch: amd64
with_elixir: 'yes'
otp: ${{ inputs.otp_vsn }}
builder: ${{ inputs.builder_vsn }}
elixir: ${{ inputs.elixir_vsn }}
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
with:
ref: ${{ github.event.inputs.ref }}
fetch-depth: 0
- name: build tgz
env:
PROFILE: ${{ matrix.profile }}
ARCH: ${{ matrix.arch }}
OS: ${{ matrix.os }}
IS_ELIXIR: ${{ matrix.with_elixir }}
BUILDER: "ghcr.io/emqx/emqx-builder/${{ matrix.builder }}:${{ matrix.elixir }}-${{ matrix.otp }}-${{ matrix.os }}"
BUILDER_SYSTEM: force_docker
run: |
./scripts/buildx.sh \
--profile $PROFILE \
--arch $ARCH \
--builder $BUILDER \
--elixir $IS_ELIXIR \
--pkgtype tgz
- name: build pkg
if: matrix.with_elixir == 'no'
env:
PROFILE: ${{ matrix.profile }}
ARCH: ${{ matrix.arch }}
OS: ${{ matrix.os }}
IS_ELIXIR: ${{ matrix.with_elixir }}
BUILDER: "ghcr.io/emqx/emqx-builder/${{ matrix.builder }}:${{ matrix.elixir }}-${{ matrix.otp }}-${{ matrix.os }}"
BUILDER_SYSTEM: force_docker
run: |
./scripts/buildx.sh \
--profile $PROFILE \
--arch $ARCH \
--builder $BUILDER \
--elixir $IS_ELIXIR \
--pkgtype pkg
- uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
with:
name: ${{ matrix.profile }}-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.with_elixir == 'yes' && '-elixir' || '' }}-${{ matrix.builder }}-${{ matrix.otp }}-${{ matrix.elixir }}
path: _packages/${{ matrix.profile }}/
retention-days: 7
publish_artifacts:
runs-on: ubuntu-latest
needs:
- mac
- linux
if: inputs.publish
strategy:
fail-fast: false
matrix:
profile:
- ${{ inputs.profile }}
steps:
- uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4
with:
pattern: "${{ matrix.profile }}-*"
path: packages/${{ matrix.profile }}
merge-multiple: true
- name: install dos2unix
run: sudo apt-get update -y && sudo apt install -y dos2unix
- name: get packages
run: |
set -eu
cd packages/${{ matrix.profile }}
# fix the .sha256 file format
for f in *.sha256; do
dos2unix $f
echo "$(cat $f) ${f%.*}" | sha256sum -c || exit 1
done
cd -
- uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_DEFAULT_REGION }}
- name: upload to aws s3
env:
PROFILE: ${{ matrix.profile }}
REF_NAME: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.ref || github.ref_name }}
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
AWS_CLOUDFRONT_ID: ${{ secrets.AWS_CLOUDFRONT_ID }}
run: |
set -eu
if [ $PROFILE = 'emqx' ]; then
s3dir='emqx-ce'
elif [ $PROFILE = 'emqx-enterprise' ]; then
s3dir='emqx-ee'
else
echo "unknown profile $PROFILE"
exit 1
fi
aws s3 cp --recursive packages/$PROFILE s3://$AWS_S3_BUCKET/$s3dir/$REF_NAME
aws cloudfront create-invalidation --distribution-id "$AWS_CLOUDFRONT_ID" --paths "/$s3dir/$REF_NAME/*"