build_packages.yaml 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654
  1. name: Cross build packages
  2. concurrency:
  3. group: build-${{ github.event_name }}-${{ github.ref }}
  4. cancel-in-progress: true
  5. on:
  6. schedule:
  7. - cron: '0 */6 * * *'
  8. push:
  9. branches:
  10. - 'ci/**'
  11. tags:
  12. - v*
  13. - e*
  14. workflow_dispatch:
  15. inputs:
  16. which_branch:
  17. required: false
  18. jobs:
  19. prepare:
  20. runs-on: ubuntu-20.04
  21. # prepare source with any OTP version, no need for a matrix
  22. container: "ghcr.io/emqx/emqx-builder/5.0-8:1.13.3-24.2.1-1-ubuntu20.04"
  23. outputs:
  24. DEP_ROCKSDB_REF: ${{ steps.deps-refs.outputs.DEP_ROCKSDB_REF }}
  25. DEP_QUICER_REF: ${{ steps.deps-refs.outputs.DEP_QUICER_REF }}
  26. steps:
  27. - uses: actions/checkout@v2
  28. with:
  29. ref: ${{ github.event.inputs.which_branch }}
  30. path: source
  31. fetch-depth: 0
  32. - name: Get deps git refs for cache
  33. id: deps-refs
  34. working-directory: source
  35. run: |
  36. bash -x scripts/get-dep-refs.sh
  37. make clean-all
  38. - name: get_all_deps
  39. run: |
  40. make -C source deps-all
  41. zip -ryq source.zip source/* source/.[^.]*
  42. - uses: actions/upload-artifact@v2
  43. with:
  44. name: source
  45. path: source.zip
  46. windows:
  47. runs-on: windows-2019
  48. needs: prepare
  49. strategy:
  50. fail-fast: false
  51. matrix:
  52. profile: # for now only CE for windows
  53. - emqx
  54. otp:
  55. - 24.2.1
  56. steps:
  57. - uses: actions/download-artifact@v2
  58. with:
  59. name: source
  60. path: .
  61. - name: unzip source code
  62. run: Expand-Archive -Path source.zip -DestinationPath ./
  63. - uses: ilammy/msvc-dev-cmd@v1
  64. - uses: erlef/setup-beam@v1
  65. with:
  66. otp-version: ${{ matrix.otp }}
  67. - name: build
  68. env:
  69. PYTHON: python
  70. DIAGNOSTIC: 1
  71. working-directory: source
  72. run: |
  73. # ensure crypto app (openssl)
  74. erl -eval "erlang:display(crypto:info_lib())" -s init stop
  75. make ${{ matrix.profile }}-tgz
  76. - name: run emqx
  77. timeout-minutes: 5
  78. working-directory: source
  79. run: |
  80. ./_build/${{ matrix.profile }}/rel/emqx/bin/emqx start
  81. Start-Sleep -s 5
  82. echo "EMQX started"
  83. ./_build/${{ matrix.profile }}/rel/emqx/bin/emqx stop
  84. echo "EMQX stopped"
  85. ./_build/${{ matrix.profile }}/rel/emqx/bin/emqx install
  86. echo "EMQX installed"
  87. ./_build/${{ matrix.profile }}/rel/emqx/bin/emqx uninstall
  88. echo "EMQX uninstalled"
  89. - uses: actions/upload-artifact@v1
  90. if: startsWith(github.ref, 'refs/tags/')
  91. with:
  92. name: ${{ matrix.profile }}-windows
  93. path: source/_packages/${{ matrix.profile }}/.
  94. mac:
  95. needs: prepare
  96. strategy:
  97. fail-fast: false
  98. matrix:
  99. profile: # no EDGE for mac
  100. - emqx
  101. - emqx-enterprise
  102. otp:
  103. - 24.2.1-1
  104. os:
  105. - macos-11
  106. - macos-10.15
  107. exclude:
  108. - profile: emqx-edge
  109. runs-on: ${{ matrix.os }}
  110. steps:
  111. - uses: actions/download-artifact@v2
  112. with:
  113. name: source
  114. path: .
  115. - name: unzip source code
  116. run: unzip -q source.zip
  117. - name: prepare
  118. run: |
  119. brew update
  120. brew install curl zip unzip gnu-sed kerl unixodbc freetds
  121. echo "/usr/local/bin" >> $GITHUB_PATH
  122. git config --global credential.helper store
  123. - uses: actions/cache@v2
  124. id: cache
  125. with:
  126. path: ~/.kerl/${{ matrix.otp }}
  127. key: otp-install-${{ matrix.otp }}-${{ matrix.os }}
  128. - name: build erlang
  129. if: steps.cache.outputs.cache-hit != 'true'
  130. timeout-minutes: 60
  131. env:
  132. KERL_BUILD_BACKEND: git
  133. OTP_GITHUB_URL: https://github.com/emqx/otp
  134. run: |
  135. kerl update releases
  136. kerl build ${{ matrix.otp }}
  137. kerl install ${{ matrix.otp }} $HOME/.kerl/${{ matrix.otp }}
  138. - name: load rocksdb cache
  139. uses: actions/cache@v2
  140. with:
  141. path: source/_build/default/lib/rocksdb/
  142. key: ${{ matrix.os }}-${{ matrix.otp }}-${{ matrix.arch }}-${{ needs.prepare.outputs.DEP_ROCKSDB_REF }}
  143. - name: load quicer cache
  144. uses: actions/cache@v2
  145. with:
  146. path: source/_build/default/lib/quicer/
  147. key: ${{ matrix.os }}-${{ matrix.otp }}-${{ matrix.arch }}-${{ needs.prepare.outputs.DEP_QUICER_REF }}
  148. - name: build
  149. working-directory: source
  150. run: |
  151. . $HOME/.kerl/${{ matrix.otp }}/activate
  152. make ensure-rebar3
  153. sudo cp rebar3 /usr/local/bin/rebar3
  154. rm -rf _build/${{ matrix.profile }}/lib
  155. make ${{ matrix.profile }}-tgz
  156. - name: test
  157. working-directory: source
  158. run: |
  159. pkg_name=$(find _packages/${{ matrix.profile }} -mindepth 1 -maxdepth 1 -iname \*.tar.gz)
  160. tar -zxf $pkg_name
  161. # gsed -i '/emqx_telemetry/d' ./emqx/data/loaded_plugins
  162. ./emqx/bin/emqx start || cat emqx/log/erlang.log.1
  163. ready='no'
  164. for i in {1..10}; do
  165. if curl -fs 127.0.0.1:18083/api/v5/status > /dev/null; then
  166. ready='yes'
  167. break
  168. fi
  169. sleep 1
  170. done
  171. if [ "$ready" != "yes" ]; then
  172. echo "Timed out waiting for emqx to be ready"
  173. cat emqx/log/erlang.log.1
  174. exit 1
  175. fi
  176. ./emqx/bin/emqx_ctl status
  177. ./emqx/bin/emqx stop
  178. rm -rf emqx
  179. - uses: actions/upload-artifact@v1
  180. if: startsWith(github.ref, 'refs/tags/')
  181. with:
  182. name: ${{ matrix.profile }}-${{ matrix.otp }}
  183. path: source/_packages/${{ matrix.profile }}/.
  184. linux:
  185. needs: prepare
  186. runs-on: ${{ matrix.build_machine }}
  187. container:
  188. image: "ghcr.io/emqx/emqx-builder/5.0-8:${{ matrix.elixir }}-${{ matrix.otp }}-${{ matrix.os }}"
  189. strategy:
  190. fail-fast: false
  191. matrix:
  192. profile: ## all editions for linux
  193. - emqx-edge
  194. - emqx
  195. - emqx-enterprise
  196. otp:
  197. - 24.2.1-1 # we test with OTP 23, but only build package on OTP 24 versions
  198. elixir:
  199. - 1.13.3
  200. # used to split elixir packages into a separate job, since the
  201. # entire job may take a lot of time, especially on arm64
  202. # emulation.
  203. # we only want to build ubuntu and centos with elixir for the
  204. # time being, so it's easier to just include those with
  205. # `with_elixir` set.
  206. build_elixir:
  207. # - with_elixir
  208. - no_elixir
  209. arch:
  210. - amd64
  211. - arm64
  212. os:
  213. - ubuntu20.04
  214. - ubuntu18.04
  215. - ubuntu16.04
  216. - debian11
  217. - debian10
  218. - debian9
  219. - rockylinux8
  220. - centos7
  221. - raspbian10
  222. build_machine:
  223. - aws-arm64
  224. - ubuntu-20.04
  225. exclude:
  226. - arch: arm64
  227. build_machine: ubuntu-20.04
  228. - arch: amd64
  229. build_machine: aws-arm64
  230. - os: raspbian9
  231. arch: amd64
  232. - os: raspbian10
  233. arch: amd64
  234. - os: raspbian10 # we only have arm32 image
  235. arch: arm64
  236. - os: raspbian9
  237. profile: emqx
  238. - os: raspbian10
  239. profile: emqx
  240. - os: raspbian9
  241. profile: emqx-enterprise
  242. - os: raspbian10
  243. profile: emqx-enterprise
  244. include:
  245. - profile: emqx
  246. otp: 24.2.1-1
  247. elixir: 1.13.3
  248. build_elixir: with_elixir
  249. arch: amd64
  250. os: ubuntu20.04
  251. build_machine: ubuntu-20.04
  252. - profile: emqx
  253. otp: 24.2.1-1
  254. elixir: 1.13.3
  255. build_elixir: with_elixir
  256. arch: amd64
  257. os: centos7
  258. build_machine: ubuntu-20.04
  259. defaults:
  260. run:
  261. shell: bash
  262. steps:
  263. - uses: AutoModality/action-clean@v1
  264. if: matrix.build_machine == 'aws-arm64'
  265. - uses: actions/download-artifact@v2
  266. with:
  267. name: source
  268. path: .
  269. - name: unzip source code
  270. run: unzip -q source.zip
  271. - name: load rocksdb cache
  272. uses: actions/cache@v2
  273. with:
  274. path: |
  275. source/_build/default/lib/rocksdb/
  276. source/deps/rocksdb/
  277. key: ${{ matrix.os }}-${{ matrix.otp }}-${{ matrix.arch }}-${{ needs.prepare.outputs.DEP_ROCKSDB_REF }}
  278. - name: load quicer cache
  279. uses: actions/cache@v2
  280. with:
  281. path: |
  282. source/_build/default/lib/quicer/
  283. source/deps/quicer/
  284. key: ${{ matrix.os }}-${{ matrix.otp }}-${{ matrix.arch }}-${{ needs.prepare.outputs.DEP_QUICER_REF }}
  285. - name: build emqx packages
  286. working-directory: source
  287. env:
  288. OTP: ${{ matrix.otp }}
  289. ELIXIR: ${{ matrix.elixir }}
  290. PROFILE: ${{ matrix.profile }}
  291. ARCH: ${{ matrix.arch }}
  292. SYSTEM: ${{ matrix.os }}
  293. run: |
  294. set -eu
  295. # Align path for CMake caches
  296. if [ ! "$PWD" = "/emqx" ]; then
  297. ln -s $PWD /emqx
  298. cd /emqx
  299. fi
  300. echo "pwd is $PWD"
  301. PkgTypes="tgz pkg"
  302. IsElixir="no"
  303. if [ ${{ matrix.build_elixir }} = "with_elixir" ]; then
  304. PkgTypes="tgz"
  305. # set Elixir build flag
  306. IsElixir="yes"
  307. fi
  308. for PKGTYPE in ${PkgTypes};
  309. do
  310. ./scripts/buildx.sh \
  311. --profile "${PROFILE}" \
  312. --pkgtype "${PKGTYPE}" \
  313. --arch "${ARCH}" \
  314. --otp "${OTP}" \
  315. --elixir "${IsElixir}" \
  316. --elixir-vsn "${ELIXIR}" \
  317. --system "${SYSTEM}" \
  318. --builder "ghcr.io/emqx/emqx-builder/5.0-8:${ELIXIR}-${OTP}-${SYSTEM}"
  319. done
  320. - uses: actions/upload-artifact@v1
  321. if: startsWith(github.ref, 'refs/tags/')
  322. with:
  323. name: ${{ matrix.profile }}-${{ matrix.otp }}
  324. path: source/_packages/${{ matrix.profile }}/.
  325. docker:
  326. runs-on: ${{ matrix.build_machine }}
  327. needs: prepare
  328. strategy:
  329. fail-fast: false
  330. matrix:
  331. os:
  332. - alpine3.14
  333. profile: # all editions for docker
  334. - emqx-edge
  335. - emqx
  336. - emqx-enterprise
  337. # NOTE: for docker, only support latest otp and elixir
  338. # versions, not a matrix
  339. otp:
  340. - 24.2.1-1 # update to latest
  341. elixir:
  342. - 1.13.3 # update to latest
  343. arch:
  344. - amd64
  345. - arm64
  346. build_elixir:
  347. - no_elixir
  348. build_machine:
  349. - aws-arm64
  350. - ubuntu-20.04
  351. exclude:
  352. - arch: arm64
  353. build_machine: ubuntu-20.04
  354. - arch: amd64
  355. build_machine: aws-arm64
  356. include:
  357. - os: alpine3.14
  358. profile: emqx
  359. otp: 24.2.1-1
  360. elixir: 1.13.3
  361. arch: amd64
  362. build_elixir: with_elixir
  363. build_machine: ubuntu-20.04
  364. steps:
  365. - uses: AutoModality/action-clean@v1
  366. if: matrix.build_machine == 'aws-arm64'
  367. - uses: actions/download-artifact@v2
  368. with:
  369. name: source
  370. path: .
  371. - name: unzip source code
  372. run: unzip -q source.zip
  373. - uses: docker/setup-buildx-action@v1
  374. - name: load rocksdb cache
  375. uses: actions/cache@v2
  376. with:
  377. path: |
  378. source/_build/default/lib/rocksdb/
  379. source/deps/rocksdb//
  380. key: ${{ matrix.os }}-${{ matrix.otp }}-${{ matrix.arch }}-${{ needs.prepare.outputs.DEP_ROCKSDB_REF }}
  381. - name: load quicer cache
  382. uses: actions/cache@v2
  383. with:
  384. path: |
  385. source/_build/default/lib/quicer/
  386. source/deps/quicer/
  387. key: ${{ matrix.os }}-${{ matrix.otp }}-${{ matrix.arch }}-${{ needs.prepare.outputs.DEP_QUICER_REF }}
  388. - uses: docker/login-action@v1
  389. with:
  390. username: ${{ secrets.DOCKER_HUB_USER }}
  391. password: ${{ secrets.DOCKER_HUB_TOKEN }}
  392. - name: prepare for docker-action-parms
  393. id: pre-meta
  394. run: |
  395. img=$(echo ${{ matrix.os }} | sed 's#\([0-9.]\+\)$#:\1#g')
  396. emqx_name=${{ matrix.profile }}
  397. img_suffix=${{ matrix.arch }}
  398. img_labels="org.opencontainers.image.otp.version=${{ matrix.otp }}"
  399. if [ ${{ matrix.build_elixir }} = "with_elixir" ]; then
  400. emqx_name="emqx-elixir"
  401. img_suffix="elixir-${{ matrix.arch }}"
  402. img_labels="org.opencontainers.image.elixir.version=${{ matrix.elixir }}\n${img_labels}"
  403. fi
  404. echo "::set-output name=img::${img}"
  405. echo "::set-output name=emqx_name::${emqx_name}"
  406. echo "::set-output name=img_suffix::${img_suffix}"
  407. echo "::set-output name=img_labels::${img_labels}"
  408. # NOTE, Pls make sure this is identical as the one in job 'docker-push-multi-arch-manifest'
  409. - uses: docker/metadata-action@v3
  410. id: meta
  411. with:
  412. images: ${{ github.repository_owner }}/${{ matrix.profile }}
  413. flavor: |
  414. latest=${{ github.event_name == 'release' && !github.event.release.prerelease }}
  415. suffix=-${{ steps.pre-meta.outputs.img_suffix }}
  416. tags: |
  417. type=ref,event=branch
  418. type=ref,event=pr
  419. type=ref,event=tag
  420. type=semver,pattern={{version}}
  421. labels:
  422. ${{ steps.pre-meta.outputs.img_labels }}
  423. - uses: docker/build-push-action@v2
  424. with:
  425. push: >
  426. ${{ (github.event_name == 'release' && !github.event.release.prerelease)
  427. || (github.event.repository.owner != 'emqx' && startsWith(github.ref_name, 'ci/')) }}
  428. pull: true
  429. no-cache: true
  430. platforms: linux/${{ matrix.arch }}
  431. tags: ${{ steps.meta.outputs.tags }}
  432. labels: ${{ steps.meta.outputs.labels }}
  433. build-args: |
  434. BUILD_FROM=ghcr.io/emqx/emqx-builder/5.0-8:${{ matrix.elixir }}-${{ matrix.otp }}-${{ matrix.os }}
  435. RUN_FROM=${{ steps.pre-meta.outputs.img }}
  436. EMQX_NAME=${{ steps.pre-meta.outputs.emqx_name }}
  437. file: source/deploy/docker/Dockerfile
  438. context: source
  439. - uses: aws-actions/configure-aws-credentials@v1
  440. if: matrix.profile == 'emqx'
  441. with:
  442. aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
  443. aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
  444. aws-region: ${{ secrets.AWS_DEFAULT_REGION }}
  445. - name: Docker push to aws ecr
  446. if: >
  447. ${{ (github.event_name == 'release' && !github.event.release.prerelease && matrix.profile == 'emqx')
  448. || (github.event.repository.owner != 'emqx' && startsWith(github.ref_name, 'ci/')) }}
  449. run: |
  450. aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws
  451. for tag in $(echo ${{ steps.meta.outputs.json }} | jq -c '.tags[]'); do
  452. docker pull "$tag"
  453. docker tag "$tag" "public.ecr.aws/$tag"
  454. docker push "public.ecr.aws/$tag"
  455. done
  456. docker-push-multi-arch-manifest:
  457. # note, we only run on amd64
  458. if: >
  459. (github.event_name == 'release' && !github.event.release.prerelease)
  460. || (github.event.repository.owner != 'emqx' && startsWith(github.ref_name, 'ci/'))
  461. needs:
  462. - prepare
  463. - docker
  464. runs-on: ubuntu-latest
  465. strategy:
  466. fail-fast: false
  467. matrix:
  468. profile: # all editions for docker
  469. - emqx-edge
  470. - emqx
  471. - emqx-enterprise
  472. # NOTE: for docker, only support latest otp version, not a matrix
  473. otp:
  474. - 24.2.1-1 # update to latest
  475. #
  476. elixir:
  477. - 1.13.3 # update to latest
  478. arch:
  479. - amd64
  480. - arm64
  481. build_elixir:
  482. - no_elixir
  483. build_machine:
  484. - aws-arm64
  485. - ubuntu-20.04
  486. exclude:
  487. - arch: arm64
  488. build_machine: ubuntu-20.04
  489. - arch: amd64
  490. build_machine: aws-arm64
  491. include:
  492. - os: alpine3.14
  493. profile: emqx
  494. otp: 24.2.1-1
  495. elixir: 1.13.3
  496. arch: amd64
  497. build_elixir: with_elixir
  498. build_machine: ubuntu-20.04
  499. steps:
  500. - uses: actions/download-artifact@v2
  501. if: matrix.arch == 'amd64'
  502. with:
  503. name: source
  504. path: .
  505. - name: unzip source code
  506. if: matrix.arch == 'amd64'
  507. run: unzip -q source.zip
  508. - uses: docker/login-action@v1
  509. if: matrix.arch == 'amd64'
  510. with:
  511. username: ${{ secrets.DOCKER_HUB_USER }}
  512. password: ${{ secrets.DOCKER_HUB_TOKEN }}
  513. - name: prepare for docker-action-parms
  514. id: pre-meta
  515. run: |
  516. img=$(echo ${{ matrix.os }} | sed 's#\([0-9.]\+\)$#:\1#g')
  517. emqx_name=${{ matrix.profile }}
  518. img_suffix=${{ matrix.arch }}
  519. img_labels="org.opencontainers.image.otp.version=${{ matrix.otp }}"
  520. if [ ${{ matrix.build_elixir }} = "with_elixir" ]; then
  521. emqx_name="emqx-elixir"
  522. img_suffix="elixir-${{ matrix.arch }}"
  523. img_labels="org.opencontainers.image.elixir.version=${{ matrix.elixir }}\n$img_labels"
  524. fi
  525. echo "::set-output name=img::${img}"
  526. echo "::set-output name=emqx_name::${emqx_name}"
  527. echo "::set-output name=img_suffix::${img_suffix}"
  528. echo "::set-output name=img_labels::${img_labels}"
  529. # NOTE, Pls make sure this is identical as the one in job 'docker'
  530. - uses: docker/metadata-action@v3
  531. if: matrix.arch == 'amd64'
  532. id: meta
  533. with:
  534. images: ${{ github.repository_owner }}/${{ matrix.profile }}
  535. flavor: |
  536. latest=false
  537. suffix=-${{ steps.pre-meta.outputs.img_suffix }}
  538. tags: |
  539. type=ref,event=branch
  540. type=ref,event=pr
  541. type=ref,event=tag
  542. type=semver,pattern={{version}}
  543. labels:
  544. ${{ steps.pre-meta.outputs.img_labels }}
  545. - name: update manifest for multiarch image
  546. if: matrix.arch == 'amd64'
  547. working-directory: source
  548. run: |
  549. IsPushLatest=${{ github.event_name == 'release' && !github.event.release.prerelease }};
  550. scripts/docker-create-push-manifests.sh "${{ steps.meta.outputs.tags }}" "$IsPushLatest"
  551. - uses: aws-actions/configure-aws-credentials@v1
  552. if: matrix.profile == 'emqx' && matrix.arch == 'amd64'
  553. with:
  554. aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
  555. aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
  556. aws-region: ${{ secrets.AWS_DEFAULT_REGION }}
  557. - name: Docker push to aws ecr
  558. if: matrix.profile == 'emqx' && matrix.arch == 'amd64'
  559. run: |
  560. aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws
  561. IsPushLatest=${{ github.event_name == 'release' && !github.event.release.prerelease }};
  562. scripts/docker-create-push-manifests.sh "public.ecr.aws/${{ steps.meta.outputs.tags }}" "$IsPushLatest"
  563. upload:
  564. runs-on: ubuntu-20.04
  565. if: startsWith(github.ref, 'refs/tags/')
  566. needs: [prepare, mac, linux, docker]
  567. strategy:
  568. fail-fast: false
  569. matrix:
  570. profile:
  571. - emqx-edge
  572. - emqx
  573. - emqx-enterprise
  574. otp:
  575. - 24.2.1-1
  576. include:
  577. - profile: emqx
  578. otp: windows # otp version on windows is rather fixed
  579. steps:
  580. - uses: actions/download-artifact@v2
  581. with:
  582. name: ${{ matrix.profile }}-${{ matrix.otp }}
  583. path: packages/${{ matrix.profile }}
  584. - name: install dos2unix
  585. run: sudo apt-get update && sudo apt install -y dos2unix
  586. - name: get packages
  587. run: |
  588. set -e -u
  589. cd packages/${{ matrix.profile }}
  590. for var in $( ls |grep emqx |grep -v sha256); do
  591. dos2unix $var.sha256
  592. echo "$(cat $var.sha256) $var" | sha256sum -c || exit 1
  593. done
  594. cd -
  595. - uses: aws-actions/configure-aws-credentials@v1
  596. with:
  597. aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
  598. aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
  599. aws-region: ${{ secrets.AWS_DEFAULT_REGION }}
  600. - name: upload aws s3
  601. env:
  602. PROFILE: ${{ matrix.profile }}
  603. run: |
  604. set -e -u
  605. if [ $PROFILE = 'emqx' ]; then
  606. s3dir='emqx-ce'
  607. elif [ $PROFILE = 'emqx-enterprise' ]; then
  608. s3dir='emqx-ee'
  609. elif [ $PROFILE = 'emqx-edge' ]; then
  610. s3dir='emqx-edge'
  611. else
  612. echo "unknown profile $PROFILE"
  613. exit 1
  614. fi
  615. aws s3 cp --recursive packages/$PROFILE s3://${{ secrets.AWS_S3_BUCKET }}/$s3dir/${{ github.ref_name }}
  616. aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_CLOUDFRONT_ID }} --paths "/$s3dir/${{ github.ref_name }}/*"