build_packages.yaml 20 KB

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