build_packages.yaml 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644
  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-14: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 automake bison
  135. echo "/usr/local/opt/bison/bin" >> $GITHUB_PATH
  136. echo "/usr/local/bin" >> $GITHUB_PATH
  137. git config --global credential.helper store
  138. - uses: actions/cache@v2
  139. id: cache
  140. with:
  141. path: ~/.kerl/${{ matrix.otp }}
  142. key: otp-install-${{ matrix.otp }}-${{ matrix.os }}
  143. - name: build erlang
  144. if: steps.cache.outputs.cache-hit != 'true'
  145. timeout-minutes: 60
  146. env:
  147. KERL_BUILD_BACKEND: git
  148. OTP_GITHUB_URL: https://github.com/emqx/otp
  149. run: |
  150. kerl update releases
  151. kerl build ${{ matrix.otp }}
  152. kerl install ${{ matrix.otp }} $HOME/.kerl/${{ matrix.otp }}
  153. - name: load quicer cache
  154. uses: actions/cache@v2
  155. with:
  156. path: source/_build/default/lib/quicer/
  157. key: ${{ matrix.os }}-${{ matrix.otp }}-${{ matrix.arch }}-${{ needs.prepare.outputs.DEP_QUICER_REF }}
  158. - name: build
  159. working-directory: source
  160. run: |
  161. . $HOME/.kerl/${{ matrix.otp }}/activate
  162. make ensure-rebar3
  163. sudo cp rebar3 /usr/local/bin/rebar3
  164. rm -rf _build/${{ matrix.profile }}/lib
  165. make ${{ matrix.profile }}-tgz
  166. - name: test
  167. working-directory: source
  168. run: |
  169. pkg_name=$(find _packages/${{ matrix.profile }} -mindepth 1 -maxdepth 1 -iname \*.tar.gz)
  170. tar -zxf $pkg_name
  171. # gsed -i '/emqx_telemetry/d' ./emqx/data/loaded_plugins
  172. ./emqx/bin/emqx start || cat emqx/log/erlang.log.1
  173. ready='no'
  174. for i in {1..10}; do
  175. if curl -fs 127.0.0.1:18083/api/v5/status > /dev/null; then
  176. ready='yes'
  177. break
  178. fi
  179. sleep 1
  180. done
  181. if [ "$ready" != "yes" ]; then
  182. echo "Timed out waiting for emqx to be ready"
  183. cat emqx/log/erlang.log.1
  184. exit 1
  185. fi
  186. ./emqx/bin/emqx_ctl status
  187. ./emqx/bin/emqx stop
  188. rm -rf emqx
  189. - uses: actions/upload-artifact@v1
  190. if: startsWith(github.ref, 'refs/tags/')
  191. with:
  192. name: ${{ matrix.profile }}-${{ matrix.otp }}
  193. path: source/_packages/${{ matrix.profile }}/.
  194. linux:
  195. needs: prepare
  196. runs-on: ${{ matrix.build_machine }}
  197. container:
  198. image: "ghcr.io/emqx/emqx-builder/5.0-14:${{ matrix.elixir }}-${{ matrix.otp }}-${{ matrix.os }}"
  199. strategy:
  200. fail-fast: false
  201. matrix:
  202. profile: ${{ fromJson(needs.prepare.outputs.BUILD_PROFILES) }}
  203. otp:
  204. - 24.2.1-1 # we test with OTP 23, but only build package on OTP 24 versions
  205. elixir:
  206. - 1.13.3
  207. # used to split elixir packages into a separate job, since the
  208. # entire job may take a lot of time, especially on arm64
  209. # emulation.
  210. # we only want to build ubuntu and centos with elixir for the
  211. # time being, so it's easier to just include those with
  212. # `with_elixir` set.
  213. build_elixir:
  214. # - with_elixir
  215. - no_elixir
  216. arch:
  217. - amd64
  218. - arm64
  219. os:
  220. - ubuntu20.04
  221. - ubuntu18.04
  222. - ubuntu16.04
  223. - debian11
  224. - debian10
  225. - debian9
  226. - el8
  227. - el7
  228. - raspbian10
  229. build_machine:
  230. - aws-arm64
  231. - ubuntu-20.04
  232. exclude:
  233. - arch: arm64
  234. build_machine: ubuntu-20.04
  235. - arch: amd64
  236. build_machine: aws-arm64
  237. - os: raspbian9
  238. arch: amd64
  239. - os: raspbian10
  240. arch: amd64
  241. - os: raspbian10 # we only have arm32 image
  242. arch: arm64
  243. - os: raspbian9
  244. profile: emqx
  245. - os: raspbian10
  246. profile: emqx
  247. - os: raspbian9
  248. profile: emqx-enterprise
  249. - os: raspbian10
  250. profile: emqx-enterprise
  251. include:
  252. - profile: emqx
  253. otp: 24.2.1-1
  254. elixir: 1.13.3
  255. build_elixir: with_elixir
  256. arch: amd64
  257. os: ubuntu20.04
  258. build_machine: ubuntu-20.04
  259. - profile: emqx
  260. otp: 24.2.1-1
  261. elixir: 1.13.3
  262. build_elixir: with_elixir
  263. arch: amd64
  264. os: el7
  265. build_machine: ubuntu-20.04
  266. defaults:
  267. run:
  268. shell: bash
  269. steps:
  270. - uses: AutoModality/action-clean@v1
  271. if: matrix.build_machine == 'aws-arm64'
  272. - uses: actions/download-artifact@v2
  273. with:
  274. name: source
  275. path: .
  276. - name: unzip source code
  277. run: unzip -q source.zip
  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. --elixir "${IsElixir}" \
  315. --builder "ghcr.io/emqx/emqx-builder/5.0-14:${ELIXIR}-${OTP}-${SYSTEM}"
  316. done
  317. - uses: actions/upload-artifact@v1
  318. if: startsWith(github.ref, 'refs/tags/')
  319. with:
  320. name: ${{ matrix.profile }}-${{ matrix.otp }}
  321. path: source/_packages/${{ matrix.profile }}/.
  322. docker:
  323. runs-on: ${{ matrix.build_machine }}
  324. needs: prepare
  325. strategy:
  326. fail-fast: false
  327. matrix:
  328. os:
  329. - alpine3.15.1
  330. profile: ${{ fromJson(needs.prepare.outputs.BUILD_PROFILES) }}
  331. # NOTE: for docker, only support latest otp and elixir
  332. # versions, not a matrix
  333. otp:
  334. - 24.2.1-1 # update to latest
  335. elixir:
  336. - 1.13.3 # update to latest
  337. arch:
  338. - amd64
  339. - arm64
  340. build_elixir:
  341. - no_elixir
  342. build_machine:
  343. - aws-arm64
  344. - ubuntu-20.04
  345. registry:
  346. - docker.io
  347. exclude:
  348. - arch: arm64
  349. build_machine: ubuntu-20.04
  350. - arch: amd64
  351. build_machine: aws-arm64
  352. include:
  353. - os: alpine3.15.1
  354. profile: emqx
  355. otp: 24.2.1-1
  356. elixir: 1.13.3
  357. arch: amd64
  358. build_elixir: no_elixir
  359. build_machine: ubuntu-20.04
  360. registry: public.ecr.aws
  361. - os: alpine3.15.1
  362. profile: emqx
  363. otp: 24.2.1-1
  364. elixir: 1.13.3
  365. arch: amd64
  366. build_elixir: with_elixir
  367. build_machine: ubuntu-20.04
  368. steps:
  369. - uses: AutoModality/action-clean@v1
  370. if: matrix.build_machine == 'aws-arm64'
  371. - uses: actions/download-artifact@v2
  372. with:
  373. name: source
  374. path: .
  375. - name: unzip source code
  376. run: unzip -q source.zip
  377. - uses: docker/setup-buildx-action@v1
  378. - name: load quicer cache
  379. uses: actions/cache@v2
  380. with:
  381. path: |
  382. source/_build/default/lib/quicer/
  383. source/deps/quicer/
  384. key: ${{ matrix.os }}-${{ matrix.otp }}-${{ matrix.arch }}-${{ needs.prepare.outputs.DEP_QUICER_REF }}
  385. - name: Login for docker.
  386. uses: docker/login-action@v1
  387. if: matrix.arch == 'amd64' && matrix.registry == 'docker.io'
  388. with:
  389. username: ${{ secrets.DOCKER_HUB_USER }}
  390. password: ${{ secrets.DOCKER_HUB_TOKEN }}
  391. - name: Login for AWS ECR
  392. uses: docker/login-action@v1
  393. if: matrix.profile == 'emqx' && matrix.arch == 'amd64' && matrix.registry == 'public.ecr.aws'
  394. with:
  395. registry: public.ecr.aws
  396. username: ${{ secrets.AWS_ACCESS_KEY_ID }}
  397. password: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
  398. ecr: true
  399. - name: prepare for docker-action-parms
  400. id: pre-meta
  401. run: |
  402. img=$(echo ${{ matrix.os }} | sed 's#\([0-9.]\+\)$#:\1#g')
  403. emqx_name=${{ matrix.profile }}
  404. img_suffix=${{ matrix.arch }}
  405. img_labels="org.opencontainers.image.otp.version=${{ matrix.otp }}"
  406. if [ ${{ matrix.build_elixir }} = "with_elixir" ]; then
  407. emqx_name="emqx-elixir"
  408. img_suffix="elixir-${{ matrix.arch }}"
  409. img_labels="org.opencontainers.image.elixir.version=${{ matrix.elixir }}\n${img_labels}"
  410. fi
  411. echo "::set-output name=img::${img}"
  412. echo "::set-output name=emqx_name::${emqx_name}"
  413. echo "::set-output name=img_suffix::${img_suffix}"
  414. echo "::set-output name=img_labels::${img_labels}"
  415. # NOTE, Pls make sure this is identical as the one in job 'docker-push-multi-arch-manifest'
  416. - uses: docker/metadata-action@v3
  417. id: meta
  418. with:
  419. images: ${{ github.repository_owner }}/${{ matrix.profile }}
  420. flavor: |
  421. latest=${{ github.event_name == 'release' && !github.event.release.prerelease }}
  422. suffix=-${{ steps.pre-meta.outputs.img_suffix }}
  423. tags: |
  424. type=ref,event=branch
  425. type=ref,event=pr
  426. type=ref,event=tag
  427. type=semver,pattern={{version}}
  428. labels:
  429. ${{ steps.pre-meta.outputs.img_labels }}
  430. - uses: docker/build-push-action@v2
  431. with:
  432. push: >
  433. ${{ (github.event_name == 'release' && !github.event.release.prerelease)
  434. || (github.event.repository.owner != 'emqx' && startsWith(github.ref_name, 'ci/')) }}
  435. pull: true
  436. no-cache: true
  437. platforms: linux/${{ matrix.arch }}
  438. tags: ${{ steps.meta.outputs.tags }}
  439. labels: ${{ steps.meta.outputs.labels }}
  440. build-args: |
  441. BUILD_FROM=ghcr.io/emqx/emqx-builder/5.0-14:${{ matrix.elixir }}-${{ matrix.otp }}-${{ matrix.os }}
  442. RUN_FROM=${{ steps.pre-meta.outputs.img }}
  443. EMQX_NAME=${{ steps.pre-meta.outputs.emqx_name }}
  444. file: source/deploy/docker/Dockerfile
  445. context: source
  446. docker-push-multi-arch-manifest:
  447. # note, we only run on amd64
  448. if: >
  449. (github.event_name == 'release' && !github.event.release.prerelease)
  450. || (github.event.repository.owner != 'emqx' && startsWith(github.ref_name, 'ci/'))
  451. needs:
  452. - prepare
  453. - docker
  454. runs-on: ubuntu-latest
  455. strategy:
  456. fail-fast: false
  457. matrix:
  458. profile: ${{ fromJson(needs.prepare.outputs.BUILD_PROFILES) }}
  459. # NOTE: for docker, only support latest otp version, not a matrix
  460. otp:
  461. - 24.2.1-1 # update to latest
  462. #
  463. elixir:
  464. - 1.13.3 # update to latest
  465. arch:
  466. - amd64
  467. - arm64
  468. build_elixir:
  469. - no_elixir
  470. build_machine:
  471. - aws-arm64
  472. - ubuntu-20.04
  473. registries:
  474. - docker.io
  475. exclude:
  476. - arch: arm64
  477. build_machine: ubuntu-20.04
  478. - arch: amd64
  479. build_machine: aws-arm64
  480. include:
  481. - os: alpine3.15.1
  482. profile: emqx
  483. otp: 24.2.1-1
  484. elixir: 1.13.3
  485. arch: amd64
  486. build_elixir: no_elixir
  487. build_machine: ubuntu-20.04
  488. registry: public.ecr.aws
  489. - os: alpine3.15.1
  490. profile: emqx
  491. otp: 24.2.1-1
  492. elixir: 1.13.3
  493. arch: amd64
  494. build_elixir: with_elixir
  495. build_machine: ubuntu-20.04
  496. registry: docker.io
  497. steps:
  498. - uses: actions/download-artifact@v2
  499. if: matrix.arch == 'amd64'
  500. with:
  501. name: source
  502. path: .
  503. - name: unzip source code
  504. if: matrix.arch == 'amd64'
  505. run: unzip -q source.zip
  506. - uses: docker/login-action@v1
  507. if: matrix.arch == 'amd64' && matrix.registry == 'docker.io'
  508. with:
  509. username: ${{ secrets.DOCKER_HUB_USER }}
  510. password: ${{ secrets.DOCKER_HUB_TOKEN }}
  511. - uses: docker/login-action@v1
  512. if: matrix.profile == 'emqx' && matrix.arch == 'amd64' && matrix.registry == 'public.ecr.aws'
  513. with:
  514. registry: public.ecr.aws
  515. username: ${{ secrets.AWS_ACCESS_KEY_ID }}
  516. password: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
  517. ecr: true
  518. - name: prepare for docker-action-parms
  519. id: pre-meta
  520. run: |
  521. img=$(echo ${{ matrix.os }} | sed 's#\([0-9.]\+\)$#:\1#g')
  522. emqx_name=${{ matrix.profile }}
  523. img_suffix=${{ matrix.arch }}
  524. img_labels="org.opencontainers.image.otp.version=${{ matrix.otp }}"
  525. if [ ${{ matrix.build_elixir }} = "with_elixir" ]; then
  526. emqx_name="emqx-elixir"
  527. img_suffix="elixir-${{ matrix.arch }}"
  528. img_labels="org.opencontainers.image.elixir.version=${{ matrix.elixir }}\n$img_labels"
  529. fi
  530. echo "::set-output name=img::${img}"
  531. echo "::set-output name=emqx_name::${emqx_name}"
  532. echo "::set-output name=img_suffix::${img_suffix}"
  533. echo "::set-output name=img_labels::${img_labels}"
  534. # NOTE, Pls make sure this is identical as the one in job 'docker'
  535. - uses: docker/metadata-action@v3
  536. if: matrix.arch == 'amd64'
  537. id: meta
  538. with:
  539. images: ${{ github.repository_owner }}/${{ matrix.profile }}
  540. flavor: |
  541. latest=false
  542. suffix=-${{ steps.pre-meta.outputs.img_suffix }}
  543. tags: |
  544. type=ref,event=branch
  545. type=ref,event=pr
  546. type=ref,event=tag
  547. type=semver,pattern={{version}}
  548. labels:
  549. ${{ steps.pre-meta.outputs.img_labels }}
  550. - name: update manifest for multiarch image
  551. if: matrix.arch == 'amd64'
  552. working-directory: source
  553. run: |
  554. IsPushLatest=${{ github.event_name == 'release' && !github.event.release.prerelease }};
  555. scripts/docker-create-push-manifests.sh "${{ steps.meta.outputs.tags }}" "$IsPushLatest"
  556. upload:
  557. runs-on: ubuntu-20.04
  558. if: startsWith(github.ref, 'refs/tags/')
  559. needs: [prepare, mac, linux, docker]
  560. strategy:
  561. fail-fast: false
  562. matrix:
  563. profile: ${{ fromJson(needs.prepare.outputs.BUILD_PROFILES) }}
  564. otp:
  565. - 24.2.1-1
  566. include:
  567. - profile: emqx
  568. otp: windows # otp version on windows is rather fixed
  569. steps:
  570. - uses: actions/download-artifact@v2
  571. with:
  572. name: ${{ matrix.profile }}-${{ matrix.otp }}
  573. path: packages/${{ matrix.profile }}
  574. - name: install dos2unix
  575. run: sudo apt-get update && sudo apt install -y dos2unix
  576. - name: get packages
  577. run: |
  578. set -e -u
  579. cd packages/${{ matrix.profile }}
  580. for var in $( ls |grep emqx |grep -v sha256); do
  581. dos2unix $var.sha256
  582. echo "$(cat $var.sha256) $var" | sha256sum -c || exit 1
  583. done
  584. cd -
  585. - uses: aws-actions/configure-aws-credentials@v1
  586. with:
  587. aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
  588. aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
  589. aws-region: ${{ secrets.AWS_DEFAULT_REGION }}
  590. - name: upload aws s3
  591. env:
  592. PROFILE: ${{ matrix.profile }}
  593. run: |
  594. set -e -u
  595. if [ $PROFILE = 'emqx' ]; then
  596. s3dir='emqx-ce'
  597. elif [ $PROFILE = 'emqx-enterprise' ]; then
  598. s3dir='emqx-ee'
  599. elif [ $PROFILE = 'emqx-edge' ]; then
  600. s3dir='emqx-edge'
  601. else
  602. echo "unknown profile $PROFILE"
  603. exit 1
  604. fi
  605. aws s3 cp --recursive packages/$PROFILE s3://${{ secrets.AWS_S3_BUCKET }}/$s3dir/${{ github.ref_name }}
  606. aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_CLOUDFRONT_ID }} --paths "/$s3dir/${{ github.ref_name }}/*"