build_packages.yaml 20 KB

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