build_packages.yaml 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646
  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. --otp "${OTP}" \
  314. --elixir "${IsElixir}" \
  315. --elixir-vsn "${ELIXIR}" \
  316. --system "${SYSTEM}" \
  317. --builder "ghcr.io/emqx/emqx-builder/5.0-10:${ELIXIR}-${OTP}-${SYSTEM}"
  318. done
  319. - uses: actions/upload-artifact@v1
  320. if: startsWith(github.ref, 'refs/tags/')
  321. with:
  322. name: ${{ matrix.profile }}-${{ matrix.otp }}
  323. path: source/_packages/${{ matrix.profile }}/.
  324. docker:
  325. runs-on: ${{ matrix.build_machine }}
  326. needs: prepare
  327. strategy:
  328. fail-fast: false
  329. matrix:
  330. os:
  331. - alpine3.15.1
  332. profile: ${{ fromJson(needs.prepare.outputs.BUILD_PROFILES) }}
  333. # NOTE: for docker, only support latest otp and elixir
  334. # versions, not a matrix
  335. otp:
  336. - 24.2.1-1 # update to latest
  337. elixir:
  338. - 1.13.3 # update to latest
  339. arch:
  340. - amd64
  341. - arm64
  342. build_elixir:
  343. - no_elixir
  344. build_machine:
  345. - aws-arm64
  346. - ubuntu-20.04
  347. registry:
  348. - docker.io
  349. exclude:
  350. - arch: arm64
  351. build_machine: ubuntu-20.04
  352. - arch: amd64
  353. build_machine: aws-arm64
  354. include:
  355. - os: alpine3.15.1
  356. profile: emqx
  357. otp: 24.2.1-1
  358. elixir: 1.13.3
  359. arch: amd64
  360. build_elixir: no_elixir
  361. build_machine: ubuntu-20.04
  362. registry: public.ecr.aws
  363. - os: alpine3.15.1
  364. profile: emqx
  365. otp: 24.2.1-1
  366. elixir: 1.13.3
  367. arch: amd64
  368. build_elixir: with_elixir
  369. build_machine: ubuntu-20.04
  370. steps:
  371. - uses: AutoModality/action-clean@v1
  372. if: matrix.build_machine == 'aws-arm64'
  373. - uses: actions/download-artifact@v2
  374. with:
  375. name: source
  376. path: .
  377. - name: unzip source code
  378. run: unzip -q source.zip
  379. - uses: docker/setup-buildx-action@v1
  380. - name: load quicer cache
  381. uses: actions/cache@v2
  382. with:
  383. path: |
  384. source/_build/default/lib/quicer/
  385. source/deps/quicer/
  386. key: ${{ matrix.os }}-${{ matrix.otp }}-${{ matrix.arch }}-${{ needs.prepare.outputs.DEP_QUICER_REF }}
  387. - name: Login for docker.
  388. uses: docker/login-action@v1
  389. if: matrix.arch == 'amd64' && matrix.registry == 'docker.io'
  390. with:
  391. username: ${{ secrets.DOCKER_HUB_USER }}
  392. password: ${{ secrets.DOCKER_HUB_TOKEN }}
  393. - name: Login for AWS ECR
  394. uses: docker/login-action@v1
  395. if: matrix.profile == 'emqx' && matrix.arch == 'amd64' && matrix.registry == 'public.ecr.aws'
  396. with:
  397. registry: public.ecr.aws
  398. username: ${{ secrets.AWS_ACCESS_KEY_ID }}
  399. password: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
  400. ecr: true
  401. - name: prepare for docker-action-parms
  402. id: pre-meta
  403. run: |
  404. img=$(echo ${{ matrix.os }} | sed 's#\([0-9.]\+\)$#:\1#g')
  405. emqx_name=${{ matrix.profile }}
  406. img_suffix=${{ matrix.arch }}
  407. img_labels="org.opencontainers.image.otp.version=${{ matrix.otp }}"
  408. if [ ${{ matrix.build_elixir }} = "with_elixir" ]; then
  409. emqx_name="emqx-elixir"
  410. img_suffix="elixir-${{ matrix.arch }}"
  411. img_labels="org.opencontainers.image.elixir.version=${{ matrix.elixir }}\n${img_labels}"
  412. fi
  413. echo "::set-output name=img::${img}"
  414. echo "::set-output name=emqx_name::${emqx_name}"
  415. echo "::set-output name=img_suffix::${img_suffix}"
  416. echo "::set-output name=img_labels::${img_labels}"
  417. # NOTE, Pls make sure this is identical as the one in job 'docker-push-multi-arch-manifest'
  418. - uses: docker/metadata-action@v3
  419. id: meta
  420. with:
  421. images: ${{ github.repository_owner }}/${{ matrix.profile }}
  422. flavor: |
  423. latest=${{ github.event_name == 'release' && !github.event.release.prerelease }}
  424. suffix=-${{ steps.pre-meta.outputs.img_suffix }}
  425. tags: |
  426. type=ref,event=branch
  427. type=ref,event=pr
  428. type=ref,event=tag
  429. type=semver,pattern={{version}}
  430. labels:
  431. ${{ steps.pre-meta.outputs.img_labels }}
  432. - uses: docker/build-push-action@v2
  433. with:
  434. push: >
  435. ${{ (github.event_name == 'release' && !github.event.release.prerelease)
  436. || (github.event.repository.owner != 'emqx' && startsWith(github.ref_name, 'ci/')) }}
  437. pull: true
  438. no-cache: true
  439. platforms: linux/${{ matrix.arch }}
  440. tags: ${{ steps.meta.outputs.tags }}
  441. labels: ${{ steps.meta.outputs.labels }}
  442. build-args: |
  443. BUILD_FROM=ghcr.io/emqx/emqx-builder/5.0-10:${{ matrix.elixir }}-${{ matrix.otp }}-${{ matrix.os }}
  444. RUN_FROM=${{ steps.pre-meta.outputs.img }}
  445. EMQX_NAME=${{ steps.pre-meta.outputs.emqx_name }}
  446. file: source/deploy/docker/Dockerfile
  447. context: source
  448. docker-push-multi-arch-manifest:
  449. # note, we only run on amd64
  450. if: >
  451. (github.event_name == 'release' && !github.event.release.prerelease)
  452. || (github.event.repository.owner != 'emqx' && startsWith(github.ref_name, 'ci/'))
  453. needs:
  454. - prepare
  455. - docker
  456. runs-on: ubuntu-latest
  457. strategy:
  458. fail-fast: false
  459. matrix:
  460. profile: ${{ fromJson(needs.prepare.outputs.BUILD_PROFILES) }}
  461. # NOTE: for docker, only support latest otp version, not a matrix
  462. otp:
  463. - 24.2.1-1 # update to latest
  464. #
  465. elixir:
  466. - 1.13.3 # update to latest
  467. arch:
  468. - amd64
  469. - arm64
  470. build_elixir:
  471. - no_elixir
  472. build_machine:
  473. - aws-arm64
  474. - ubuntu-20.04
  475. registries:
  476. - docker.io
  477. exclude:
  478. - arch: arm64
  479. build_machine: ubuntu-20.04
  480. - arch: amd64
  481. build_machine: aws-arm64
  482. include:
  483. - os: alpine3.15.1
  484. profile: emqx
  485. otp: 24.2.1-1
  486. elixir: 1.13.3
  487. arch: amd64
  488. build_elixir: no_elixir
  489. build_machine: ubuntu-20.04
  490. registry: public.ecr.aws
  491. - os: alpine3.15.1
  492. profile: emqx
  493. otp: 24.2.1-1
  494. elixir: 1.13.3
  495. arch: amd64
  496. build_elixir: with_elixir
  497. build_machine: ubuntu-20.04
  498. registry: docker.io
  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' && matrix.registry == 'docker.io'
  510. with:
  511. username: ${{ secrets.DOCKER_HUB_USER }}
  512. password: ${{ secrets.DOCKER_HUB_TOKEN }}
  513. - uses: docker/login-action@v1
  514. if: matrix.profile == 'emqx' && matrix.arch == 'amd64' && matrix.registry == 'public.ecr.aws'
  515. with:
  516. registry: public.ecr.aws
  517. username: ${{ secrets.AWS_ACCESS_KEY_ID }}
  518. password: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
  519. ecr: true
  520. - name: prepare for docker-action-parms
  521. id: pre-meta
  522. run: |
  523. img=$(echo ${{ matrix.os }} | sed 's#\([0-9.]\+\)$#:\1#g')
  524. emqx_name=${{ matrix.profile }}
  525. img_suffix=${{ matrix.arch }}
  526. img_labels="org.opencontainers.image.otp.version=${{ matrix.otp }}"
  527. if [ ${{ matrix.build_elixir }} = "with_elixir" ]; then
  528. emqx_name="emqx-elixir"
  529. img_suffix="elixir-${{ matrix.arch }}"
  530. img_labels="org.opencontainers.image.elixir.version=${{ matrix.elixir }}\n$img_labels"
  531. fi
  532. echo "::set-output name=img::${img}"
  533. echo "::set-output name=emqx_name::${emqx_name}"
  534. echo "::set-output name=img_suffix::${img_suffix}"
  535. echo "::set-output name=img_labels::${img_labels}"
  536. # NOTE, Pls make sure this is identical as the one in job 'docker'
  537. - uses: docker/metadata-action@v3
  538. if: matrix.arch == 'amd64'
  539. id: meta
  540. with:
  541. images: ${{ github.repository_owner }}/${{ matrix.profile }}
  542. flavor: |
  543. latest=false
  544. suffix=-${{ steps.pre-meta.outputs.img_suffix }}
  545. tags: |
  546. type=ref,event=branch
  547. type=ref,event=pr
  548. type=ref,event=tag
  549. type=semver,pattern={{version}}
  550. labels:
  551. ${{ steps.pre-meta.outputs.img_labels }}
  552. - name: update manifest for multiarch image
  553. if: matrix.arch == 'amd64'
  554. working-directory: source
  555. run: |
  556. IsPushLatest=${{ github.event_name == 'release' && !github.event.release.prerelease }};
  557. scripts/docker-create-push-manifests.sh "${{ steps.meta.outputs.tags }}" "$IsPushLatest"
  558. upload:
  559. runs-on: ubuntu-20.04
  560. if: startsWith(github.ref, 'refs/tags/')
  561. needs: [prepare, mac, linux, docker]
  562. strategy:
  563. fail-fast: false
  564. matrix:
  565. profile: ${{ fromJson(needs.prepare.outputs.BUILD_PROFILES) }}
  566. otp:
  567. - 24.2.1-1
  568. include:
  569. - profile: emqx
  570. otp: windows # otp version on windows is rather fixed
  571. steps:
  572. - uses: actions/download-artifact@v2
  573. with:
  574. name: ${{ matrix.profile }}-${{ matrix.otp }}
  575. path: packages/${{ matrix.profile }}
  576. - name: install dos2unix
  577. run: sudo apt-get update && sudo apt install -y dos2unix
  578. - name: get packages
  579. run: |
  580. set -e -u
  581. cd packages/${{ matrix.profile }}
  582. for var in $( ls |grep emqx |grep -v sha256); do
  583. dos2unix $var.sha256
  584. echo "$(cat $var.sha256) $var" | sha256sum -c || exit 1
  585. done
  586. cd -
  587. - uses: aws-actions/configure-aws-credentials@v1
  588. with:
  589. aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
  590. aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
  591. aws-region: ${{ secrets.AWS_DEFAULT_REGION }}
  592. - name: upload aws s3
  593. env:
  594. PROFILE: ${{ matrix.profile }}
  595. run: |
  596. set -e -u
  597. if [ $PROFILE = 'emqx' ]; then
  598. s3dir='emqx-ce'
  599. elif [ $PROFILE = 'emqx-enterprise' ]; then
  600. s3dir='emqx-ee'
  601. elif [ $PROFILE = 'emqx-edge' ]; then
  602. s3dir='emqx-edge'
  603. else
  604. echo "unknown profile $PROFILE"
  605. exit 1
  606. fi
  607. aws s3 cp --recursive packages/$PROFILE s3://${{ secrets.AWS_S3_BUCKET }}/$s3dir/${{ github.ref_name }}
  608. aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_CLOUDFRONT_ID }} --paths "/$s3dir/${{ github.ref_name }}/*"