build_packages.yaml 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648
  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-16:1.13.4-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\"]"
  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\",\"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. with:
  107. name: ${{ matrix.profile }}-windows
  108. path: source/_packages/${{ matrix.profile }}/.
  109. mac:
  110. needs: prepare
  111. strategy:
  112. fail-fast: false
  113. matrix:
  114. profile: ${{ fromJson(needs.prepare.outputs.BUILD_PROFILES) }}
  115. otp:
  116. - 24.2.1-1
  117. os:
  118. - macos-11
  119. - macos-10.15
  120. runs-on: ${{ matrix.os }}
  121. steps:
  122. - uses: actions/download-artifact@v2
  123. with:
  124. name: source
  125. path: .
  126. - name: unzip source code
  127. run: unzip -q source.zip
  128. - name: prepare
  129. run: |
  130. brew update
  131. brew install curl zip unzip kerl
  132. echo "/usr/local/opt/bison/bin" >> $GITHUB_PATH
  133. echo "/usr/local/bin" >> $GITHUB_PATH
  134. git config --global credential.helper store
  135. - uses: actions/cache@v2
  136. id: cache
  137. with:
  138. path: ~/.kerl/${{ matrix.otp }}
  139. key: otp-install-${{ matrix.otp }}-${{ matrix.os }}
  140. - name: build erlang
  141. if: steps.cache.outputs.cache-hit != 'true'
  142. timeout-minutes: 60
  143. env:
  144. KERL_BUILD_BACKEND: git
  145. OTP_GITHUB_URL: https://github.com/emqx/otp
  146. run: |
  147. kerl update releases
  148. kerl build ${{ matrix.otp }}
  149. kerl install ${{ matrix.otp }} $HOME/.kerl/${{ matrix.otp }}
  150. - name: load quicer cache
  151. uses: actions/cache@v2
  152. with:
  153. path: source/_build/default/lib/quicer/
  154. key: ${{ matrix.os }}-${{ matrix.otp }}-${{ matrix.arch }}-${{ needs.prepare.outputs.DEP_QUICER_REF }}
  155. - name: build
  156. working-directory: source
  157. env:
  158. AUTO_INSTALL_BUILD_DEPS: 1
  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. mkdir -p emqx
  170. tar -C emqx -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. 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-16:${{ 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.4
  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. - el8
  226. - el7
  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.4
  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.4
  261. build_elixir: with_elixir
  262. arch: amd64
  263. os: el7
  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. git config --global --add safe.directory "/__w/emqx/emqx"
  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-16:${ELIXIR}-${OTP}-${SYSTEM}"
  316. done
  317. - uses: actions/upload-artifact@v1
  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, "alpine:3.15.1", "deploy/docker/Dockerfile.alpine"]
  329. - [debian11, "debian:11-slim", "deploy/docker/Dockerfile"]
  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.4 # 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: [debian11, "debian:11-slim", "deploy/docker/Dockerfile"]
  354. profile: emqx
  355. otp: 24.2.1-1
  356. elixir: 1.13.4
  357. arch: amd64
  358. build_elixir: no_elixir
  359. build_machine: ubuntu-20.04
  360. registry: public.ecr.aws
  361. - os: [debian11, "debian:11-slim", "deploy/docker/Dockerfile"]
  362. profile: emqx
  363. otp: 24.2.1-1
  364. elixir: 1.13.4
  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[0] }}-${{ 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. 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. if [[ ${{ matrix.os[0] }} =~ "alpine" ]]; then
  411. img_suffix="${img_suffix}-alpine"
  412. fi
  413. echo "::set-output name=emqx_name::${emqx_name}"
  414. echo "::set-output name=img_suffix::${img_suffix}"
  415. echo "::set-output name=img_labels::${img_labels}"
  416. # NOTE, Pls make sure this is identical as the one in job 'docker-push-multi-arch-manifest'
  417. - uses: docker/metadata-action@v3
  418. id: meta
  419. with:
  420. images: ${{ github.repository_owner }}/${{ matrix.profile }}
  421. flavor: |
  422. latest=${{ github.event_name == 'release' && !github.event.release.prerelease }}
  423. suffix=-${{ steps.pre-meta.outputs.img_suffix }}
  424. tags: |
  425. type=ref,event=branch
  426. type=ref,event=pr
  427. type=ref,event=tag
  428. type=semver,pattern={{version}}
  429. labels:
  430. ${{ steps.pre-meta.outputs.img_labels }}
  431. - uses: docker/build-push-action@v2
  432. with:
  433. push: >
  434. ${{ (github.event_name == 'release' && !github.event.release.prerelease)
  435. || (github.event.repository.owner != 'emqx' && startsWith(github.ref_name, 'ci/')) }}
  436. pull: true
  437. no-cache: true
  438. platforms: linux/${{ matrix.arch }}
  439. tags: ${{ steps.meta.outputs.tags }}
  440. labels: ${{ steps.meta.outputs.labels }}
  441. build-args: |
  442. BUILD_FROM=ghcr.io/emqx/emqx-builder/5.0-16:${{ matrix.elixir }}-${{ matrix.otp }}-${{ matrix.os[0] }}
  443. RUN_FROM=${{ matrix.os[1] }}
  444. EMQX_NAME=${{ steps.pre-meta.outputs.emqx_name }}
  445. file: source/${{ matrix.os[2] }}
  446. context: source
  447. docker-push-multi-arch-manifest:
  448. # note, we only run on amd64
  449. if: >
  450. (github.event_name == 'release' && !github.event.release.prerelease)
  451. || (github.event.repository.owner != 'emqx' && startsWith(github.ref_name, 'ci/'))
  452. needs:
  453. - prepare
  454. - docker
  455. runs-on: ubuntu-latest
  456. strategy:
  457. fail-fast: false
  458. matrix:
  459. os:
  460. - [alpine3.15.1, "alpine:3.15.1", "deploy/docker/Dockerfile.alpine"]
  461. - [debian11, "debian:11-slim", "deploy/docker/Dockerfile"]
  462. profile: ${{ fromJson(needs.prepare.outputs.BUILD_PROFILES) }}
  463. # NOTE: for docker, only support latest otp version, not a matrix
  464. otp:
  465. - 24.2.1-1 # update to latest
  466. #
  467. elixir:
  468. - 1.13.4 # update to latest
  469. arch:
  470. - amd64
  471. - arm64
  472. build_elixir:
  473. - no_elixir
  474. build_machine:
  475. - aws-arm64
  476. - ubuntu-20.04
  477. registries:
  478. - docker.io
  479. exclude:
  480. - arch: arm64
  481. build_machine: ubuntu-20.04
  482. - arch: amd64
  483. build_machine: aws-arm64
  484. include:
  485. - os: [debian11, "debian:11-slim", "deploy/docker/Dockerfile"]
  486. profile: emqx
  487. otp: 24.2.1-1
  488. elixir: 1.13.4
  489. arch: amd64
  490. build_elixir: no_elixir
  491. build_machine: ubuntu-20.04
  492. registry: public.ecr.aws
  493. - os: [debian11, "debian:11-slim", "deploy/docker/Dockerfile"]
  494. profile: emqx
  495. otp: 24.2.1-1
  496. elixir: 1.13.4
  497. arch: amd64
  498. build_elixir: with_elixir
  499. build_machine: ubuntu-20.04
  500. registry: docker.io
  501. steps:
  502. - uses: actions/download-artifact@v2
  503. if: matrix.arch == 'amd64'
  504. with:
  505. name: source
  506. path: .
  507. - name: unzip source code
  508. if: matrix.arch == 'amd64'
  509. run: unzip -q source.zip
  510. - uses: docker/login-action@v1
  511. if: matrix.arch == 'amd64' && matrix.registry == 'docker.io'
  512. with:
  513. username: ${{ secrets.DOCKER_HUB_USER }}
  514. password: ${{ secrets.DOCKER_HUB_TOKEN }}
  515. - uses: docker/login-action@v1
  516. if: matrix.profile == 'emqx' && matrix.arch == 'amd64' && matrix.registry == 'public.ecr.aws'
  517. with:
  518. registry: public.ecr.aws
  519. username: ${{ secrets.AWS_ACCESS_KEY_ID }}
  520. password: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
  521. ecr: true
  522. - name: prepare for docker-action-parms
  523. id: pre-meta
  524. run: |
  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. if [[ ${{ matrix.os[0] }} =~ "alpine" ]]; then
  534. img_suffix="${img_suffix}-alpine"
  535. fi
  536. echo "::set-output name=img::${img}"
  537. echo "::set-output name=emqx_name::${emqx_name}"
  538. echo "::set-output name=img_suffix::${img_suffix}"
  539. echo "::set-output name=img_labels::${img_labels}"
  540. # NOTE, Pls make sure this is identical as the one in job 'docker'
  541. - uses: docker/metadata-action@v3
  542. if: matrix.arch == 'amd64'
  543. id: meta
  544. with:
  545. images: ${{ github.repository_owner }}/${{ matrix.profile }}
  546. flavor: |
  547. latest=false
  548. suffix=-${{ steps.pre-meta.outputs.img_suffix }}
  549. tags: |
  550. type=ref,event=branch
  551. type=ref,event=pr
  552. type=ref,event=tag
  553. type=semver,pattern={{version}}
  554. labels:
  555. ${{ steps.pre-meta.outputs.img_labels }}
  556. - name: update manifest for multiarch image
  557. if: matrix.arch == 'amd64'
  558. working-directory: source
  559. run: |
  560. IsPushLatest=${{ github.event_name == 'release' && !github.event.release.prerelease }};
  561. scripts/docker-create-push-manifests.sh "${{ steps.meta.outputs.tags }}" "$IsPushLatest"
  562. publish_artifacts:
  563. runs-on: ubuntu-20.04
  564. if: startsWith(github.ref, 'refs/tags/')
  565. needs: [prepare, mac, linux, docker]
  566. strategy:
  567. fail-fast: false
  568. matrix:
  569. profile: ${{ fromJson(needs.prepare.outputs.BUILD_PROFILES) }}
  570. otp:
  571. - 24.2.1-1
  572. include:
  573. - profile: emqx
  574. otp: windows # otp version on windows is rather fixed
  575. steps:
  576. - uses: actions/download-artifact@v2
  577. with:
  578. name: ${{ matrix.profile }}-${{ matrix.otp }}
  579. path: packages/${{ matrix.profile }}
  580. - name: install dos2unix
  581. run: sudo apt-get update && sudo apt install -y dos2unix
  582. - name: get packages
  583. run: |
  584. set -e -u
  585. cd packages/${{ matrix.profile }}
  586. for var in $( ls |grep emqx |grep -v sha256); do
  587. dos2unix $var.sha256
  588. echo "$(cat $var.sha256) $var" | sha256sum -c || exit 1
  589. done
  590. cd -
  591. - uses: aws-actions/configure-aws-credentials@v1
  592. with:
  593. aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
  594. aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
  595. aws-region: ${{ secrets.AWS_DEFAULT_REGION }}
  596. - name: upload to aws s3
  597. env:
  598. PROFILE: ${{ matrix.profile }}
  599. run: |
  600. set -e -u
  601. if [ $PROFILE = 'emqx' ]; then
  602. s3dir='emqx-ce'
  603. elif [ $PROFILE = 'emqx-enterprise' ]; then
  604. s3dir='emqx-ee'
  605. else
  606. echo "unknown profile $PROFILE"
  607. exit 1
  608. fi
  609. aws s3 cp --recursive packages/$PROFILE s3://${{ secrets.AWS_S3_BUCKET }}/$s3dir/${{ github.ref_name }}
  610. aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_CLOUDFRONT_ID }} --paths "/$s3dir/${{ github.ref_name }}/*"