build_packages.yaml 20 KB

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