build_packages.yaml 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581
  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. release:
  9. types:
  10. - published
  11. workflow_dispatch:
  12. inputs:
  13. which_branch:
  14. required: false
  15. jobs:
  16. prepare:
  17. runs-on: ubuntu-20.04
  18. # prepare source with any OTP version, no need for a matrix
  19. container: "ghcr.io/emqx/emqx-builder/5.0-3:24.1.5-3-ubuntu20.04"
  20. outputs:
  21. old_vsns: ${{ steps.find_old_versons.outputs.old_vsns }}
  22. steps:
  23. - uses: actions/checkout@v2
  24. with:
  25. ref: ${{ github.event.inputs.which_branch }}
  26. path: source
  27. fetch-depth: 0
  28. - name: find old versions
  29. id: find_old_versons
  30. shell: bash
  31. working-directory: source
  32. run: |
  33. vsn="$(./pkg-vsn.sh)"
  34. pre_vsn="$(echo $vsn | grep -oE '^[0-9]+.[0-9]')"
  35. old_vsns="$(git tag -l "v$pre_vsn.[0-9]" | xargs echo -n | sed "s/v$vsn//")"
  36. echo "::set-output name=old_vsns::$old_vsns"
  37. - name: get_all_deps
  38. run: |
  39. make -C source deps-all
  40. zip -ryq source.zip source/* source/.[^.]*
  41. - uses: actions/upload-artifact@v2
  42. with:
  43. name: source
  44. path: source.zip
  45. windows:
  46. runs-on: windows-2019
  47. needs: prepare
  48. strategy:
  49. fail-fast: false
  50. matrix:
  51. profile: # only CE for windows
  52. - emqx
  53. otp:
  54. - 23.2
  55. steps:
  56. - uses: actions/download-artifact@v2
  57. with:
  58. name: source
  59. path: .
  60. - name: unzip source code
  61. run: Expand-Archive -Path source.zip -DestinationPath ./
  62. - uses: ilammy/msvc-dev-cmd@v1
  63. - uses: gleam-lang/setup-erlang@v1.1.2
  64. id: install_erlang
  65. ## gleam-lang/setup-erlang does not yet support the installation of otp24 on windows
  66. with:
  67. otp-version: ${{ matrix.otp }}
  68. - name: build
  69. env:
  70. PYTHON: python
  71. DIAGNOSTIC: 1
  72. working-directory: source
  73. run: |
  74. $env:PATH = "${{ steps.install_erlang.outputs.erlpath }}\bin;$env:PATH"
  75. $version = $( "${{ github.ref }}" -replace "^(.*)/(.*)/" )
  76. if ($version -match "^v[0-9]+\.[0-9]+(\.[0-9]+)?") {
  77. $regex = "[0-9]+\.[0-9]+(-alpha|-beta|-rc)?\.[0-9]+"
  78. $pkg_name = "${{ matrix.profile }}-$([regex]::matches($version, $regex).value)-otp${{ matrix.otp }}-windows-amd64.zip"
  79. }
  80. else {
  81. $pkg_name = "${{ matrix.profile }}-$($version -replace '/')-otp${{ matrix.otp }}-windows-amd64.zip"
  82. }
  83. ## We do not build/release bcrypt and quic for windows package
  84. Remove-Item -Recurse -Force -Path _build/default/lib/bcrypt/
  85. Remove-Item -Recurse -Force -Path _build/default/lib/quicer/
  86. if (Test-Path rebar.lock) {
  87. Remove-Item -Force -Path rebar.lock
  88. }
  89. make ensure-rebar3
  90. copy rebar3 "${{ steps.install_erlang.outputs.erlpath }}\bin"
  91. ls "${{ steps.install_erlang.outputs.erlpath }}\bin"
  92. rebar3 --help
  93. make ${{ matrix.profile }}
  94. mkdir -p _packages/${{ matrix.profile }}
  95. Compress-Archive -Path _build/${{ matrix.profile }}/rel/emqx -DestinationPath _build/${{ matrix.profile }}/rel/$pkg_name
  96. mv _build/${{ matrix.profile }}/rel/$pkg_name _packages/${{ matrix.profile }}
  97. Get-FileHash -Path "_packages/${{ matrix.profile }}/$pkg_name" | Format-List | grep 'Hash' | awk '{print $3}' > _packages/${{ matrix.profile }}/$pkg_name.sha256
  98. - name: run emqx
  99. timeout-minutes: 1
  100. working-directory: source
  101. run: |
  102. ./_build/${{ matrix.profile }}/rel/emqx/bin/emqx start
  103. Start-Sleep -s 5
  104. ./_build/${{ matrix.profile }}/rel/emqx/bin/emqx stop
  105. ./_build/${{ matrix.profile }}/rel/emqx/bin/emqx install
  106. ./_build/${{ matrix.profile }}/rel/emqx/bin/emqx uninstall
  107. - uses: actions/upload-artifact@v1
  108. if: startsWith(github.ref, 'refs/tags/')
  109. with:
  110. name: ${{ matrix.profile }}
  111. path: source/_packages/${{ matrix.profile }}/.
  112. mac:
  113. needs: prepare
  114. strategy:
  115. fail-fast: false
  116. matrix:
  117. profile: # no EDGE for mac
  118. - emqx
  119. - emqx-enterprise
  120. otp:
  121. - 24.1.5-3
  122. macos:
  123. - macos-11
  124. - macos-10.15
  125. exclude:
  126. - profile: emqx-edge
  127. runs-on: ${{ matrix.macos }}
  128. steps:
  129. - uses: actions/download-artifact@v2
  130. with:
  131. name: source
  132. path: .
  133. - name: unzip source code
  134. run: unzip -q source.zip
  135. - name: prepare
  136. run: |
  137. brew update
  138. brew install curl zip unzip gnu-sed kerl unixodbc freetds
  139. echo "/usr/local/bin" >> $GITHUB_PATH
  140. git config --global credential.helper store
  141. - uses: actions/cache@v2
  142. id: cache
  143. with:
  144. path: ~/.kerl
  145. key: otp-${{ matrix.otp }}-${{ matrix.macos }}
  146. - name: build erlang
  147. if: steps.cache.outputs.cache-hit != 'true'
  148. timeout-minutes: 60
  149. env:
  150. KERL_BUILD_BACKEND: git
  151. OTP_GITHUB_URL: https://github.com/emqx/otp
  152. run: |
  153. kerl update releases
  154. kerl build ${{ matrix.otp }}
  155. kerl install ${{ matrix.otp }} $HOME/.kerl/${{ matrix.otp }}
  156. - name: Get deps git refs for cache
  157. id: deps-refs
  158. run: |
  159. cd source
  160. . $HOME/.kerl/${{ matrix.otp }}/activate
  161. make ensure-rebar3
  162. sudo cp rebar3 /usr/local/bin/rebar3
  163. rebar3 get-deps
  164. RocksDBRef=$(erl -noshell -eval '{ok,Raw}=file:consult("rebar.lock"), {_Vsn, Deps}=hd(Raw), {_, {git, _Url, {ref, Ref}},_} = lists:keyfind(<<"rocksdb">>,1, Deps), io:format("~s",[Ref]), init:stop().')
  165. echo "::set-output name=DEP_ROCKSDB_REF::${RocksDBRef}"
  166. QuicerRef=$(erl -noshell -eval '{ok,Raw}=file:consult("rebar.lock"), {_Vsn, Deps}=hd(Raw), {_, {git, _Url, {ref, Ref}},_} = lists:keyfind(<<"quicer">>,1, Deps), io:format("~s",[Ref]), init:stop().')
  167. echo "::set-output name=DEP_QUICER_REF::${QuicerRef}"
  168. make clean-all
  169. - name: load rocksdb cache
  170. uses: actions/cache@v2
  171. with:
  172. path: source/_build/default/lib/rocksdb/
  173. key: ${{ matrix.os }}-${{ matrix.otp }}-${{ matrix.arch }}-${{ steps.deps-refs.outputs.DEP_ROCKSDB_REF }}
  174. - name: load quicer cache
  175. uses: actions/cache@v2
  176. with:
  177. path: source/_build/default/lib/quicer/
  178. key: ${{ matrix.os }}-${{ matrix.otp }}-${{ matrix.arch }}-${{ steps.deps-refs.outputs.DEP_QUICER_REF }}
  179. - name: build
  180. working-directory: source
  181. run: |
  182. . $HOME/.kerl/${{ matrix.otp }}/activate
  183. make ensure-rebar3
  184. sudo cp rebar3 /usr/local/bin/rebar3
  185. rm -rf _build/${{ matrix.profile }}/lib
  186. make ${{ matrix.profile }}-zip
  187. - name: test
  188. working-directory: source
  189. run: |
  190. pkg_name=$(find _packages/${{ matrix.profile }} -mindepth 1 -maxdepth 1 -iname \*.zip)
  191. unzip -q $pkg_name
  192. # gsed -i '/emqx_telemetry/d' ./emqx/data/loaded_plugins
  193. ./emqx/bin/emqx start || cat emqx/log/erlang.log.1
  194. ready='no'
  195. for i in {1..10}; do
  196. if curl -fs 127.0.0.1:18083/api/v5/status > /dev/null; then
  197. ready='yes'
  198. break
  199. fi
  200. sleep 1
  201. done
  202. if [ "$ready" != "yes" ]; then
  203. echo "Timed out waiting for emqx to be ready"
  204. cat emqx/log/erlang.log.1
  205. exit 1
  206. fi
  207. ./emqx/bin/emqx_ctl status
  208. ./emqx/bin/emqx stop
  209. rm -rf emqx
  210. openssl dgst -sha256 $pkg_name | awk '{print $2}' > $pkg_name.sha256
  211. - uses: actions/upload-artifact@v1
  212. if: startsWith(github.ref, 'refs/tags/')
  213. with:
  214. name: ${{ matrix.profile }}-${{ matrix.otp }}
  215. path: source/_packages/${{ matrix.profile }}/.
  216. linux:
  217. runs-on: ubuntu-20.04
  218. needs: prepare
  219. strategy:
  220. fail-fast: false
  221. matrix:
  222. profile: ## all editions for linux
  223. - emqx-edge
  224. - emqx
  225. - emqx-enterprise
  226. otp:
  227. - 24.1.5-3 # we test with OTP 23, but only build package on OTP 24 versions
  228. arch:
  229. - amd64
  230. - arm64
  231. os:
  232. - ubuntu20.04
  233. - ubuntu18.04
  234. - ubuntu16.04
  235. - debian10
  236. - debian9
  237. # - opensuse
  238. - centos8
  239. - centos7
  240. - raspbian10
  241. # - raspbian9
  242. exclude:
  243. - os: raspbian9
  244. arch: amd64
  245. - os: raspbian10
  246. arch: amd64
  247. - os: raspbian9
  248. profile: emqx
  249. - os: raspbian10
  250. profile: emqx
  251. - os: raspbian9
  252. profile: emqx-enterprise
  253. - os: raspbian10
  254. profile: emqx-enterprise
  255. defaults:
  256. run:
  257. shell: bash
  258. steps:
  259. - uses: docker/setup-buildx-action@v1
  260. - uses: docker/setup-qemu-action@v1
  261. with:
  262. image: tonistiigi/binfmt:latest
  263. platforms: all
  264. - uses: actions/download-artifact@v2
  265. with:
  266. name: source
  267. path: .
  268. - name: unzip source code
  269. run: unzip -q source.zip
  270. - name: Get deps git refs for cache
  271. id: deps-refs
  272. run: |
  273. cd source
  274. rebar3 get-deps
  275. RocksDBRef=$(erl -noshell -eval '{ok,Raw}=file:consult("rebar.lock"), {_Vsn, Deps}=hd(Raw), {_, {git, _Url, {ref, Ref}},_} = lists:keyfind(<<"rocksdb">>,1, Deps), io:format("~s",[Ref]), init:stop().')
  276. echo "::set-output name=DEP_ROCKSDB_REF::${RocksDBRef}"
  277. QuicerRef=$(erl -noshell -eval '{ok,Raw}=file:consult("rebar.lock"), {_Vsn, Deps}=hd(Raw), {_, {git, _Url, {ref, Ref}},_} = lists:keyfind(<<"quicer">>,1, Deps), io:format("~s",[Ref]), init:stop().')
  278. echo "::set-output name=DEP_QUICER_REF::${QuicerRef}"
  279. make clean-all
  280. - name: load rocksdb cache
  281. uses: actions/cache@v2
  282. with:
  283. path: source/_build/default/lib/rocksdb/
  284. key: ${{ matrix.os }}-${{ matrix.otp }}-${{ matrix.arch }}-${{ steps.deps-refs.outputs.DEP_ROCKSDB_REF }}
  285. - name: load quicer cache
  286. uses: actions/cache@v2
  287. with:
  288. path: source/_build/default/lib/quicer/
  289. key: ${{ matrix.os }}-${{ matrix.otp }}-${{ matrix.arch }}-${{ steps.deps-refs.outputs.DEP_QUICER_REF }}
  290. - name: downloads old emqx zip packages
  291. env:
  292. OTP_VSN: ${{ matrix.otp }}
  293. PROFILE: ${{ matrix.profile }}
  294. ARCH: ${{ matrix.arch }}
  295. SYSTEM: ${{ matrix.os }}
  296. OLD_VSNS: ${{ needs.prepare.outputs.old_vsns }}
  297. working-directory: source
  298. run: |
  299. set -e -x -u
  300. broker=$PROFILE
  301. if [ $PROFILE = "emqx" ];then
  302. broker="emqx-ce"
  303. fi
  304. if [ ! -z "$(echo $SYSTEM | grep -oE 'raspbian')" ]; then
  305. export ARCH="arm"
  306. fi
  307. mkdir -p _upgrade_base
  308. cd _upgrade_base
  309. old_vsns=($(echo $OLD_VSNS | tr ' ' ' '))
  310. for tag in ${old_vsns[@]}; do
  311. package_name="${PROFILE}-${tag#[e|v]}-otp${OTP_VSN}-${SYSTEM}-${ARCH}"
  312. if [ ! -z "$(echo $(curl -I -m 10 -o /dev/null -s -w %{http_code} https://s3-us-west-2.amazonaws.com/packages.emqx/$broker/$tag/$package_name.zip) | grep -oE "^[23]+")" ]; then
  313. wget --no-verbose https://s3-us-west-2.amazonaws.com/packages.emqx/$broker/$tag/$package_name.zip
  314. wget --no-verbose https://s3-us-west-2.amazonaws.com/packages.emqx/$broker/$tag/$package_name.zip.sha256
  315. echo "$(cat $package_name.zip.sha256) $package_name.zip" | sha256sum -c || exit 1
  316. fi
  317. done
  318. - name: build emqx packages
  319. env:
  320. OTP: ${{ matrix.otp }}
  321. PROFILE: ${{ matrix.profile }}
  322. ARCH: ${{ matrix.arch }}
  323. SYSTEM: ${{ matrix.os }}
  324. working-directory: source
  325. run: |
  326. ./scripts/buildx.sh \
  327. --profile "${PROFILE}" \
  328. --pkgtype "zip" \
  329. --arch "${ARCH}" \
  330. --builder "ghcr.io/emqx/emqx-builder/5.0-3:${OTP}-${SYSTEM}"
  331. ## the pkg build is incremental on the zip build
  332. ./scripts/buildx.sh \
  333. --profile "${PROFILE}" \
  334. --pkgtype "pkg" \
  335. --arch "${ARCH}" \
  336. --builder "ghcr.io/emqx/emqx-builder/5.0-3:${OTP}-${SYSTEM}"
  337. - name: create sha256
  338. env:
  339. PROFILE: ${{ matrix.profile}}
  340. working-directory: source
  341. run: |
  342. if [ -d _packages/$PROFILE ]; then
  343. cd _packages/$PROFILE
  344. for var in $(ls emqx-* ); do
  345. sudo bash -c "echo $(sha256sum $var | awk '{print $1}') > $var.sha256"
  346. done
  347. cd -
  348. fi
  349. - uses: actions/upload-artifact@v1
  350. if: startsWith(github.ref, 'refs/tags/')
  351. with:
  352. name: ${{ matrix.profile }}-${{ matrix.otp }}
  353. path: source/_packages/${{ matrix.profile }}/.
  354. docker:
  355. runs-on: ubuntu-20.04
  356. needs: prepare
  357. strategy:
  358. fail-fast: false
  359. matrix:
  360. profile: # all editions for docker
  361. - emqx-edge
  362. - emqx
  363. - emqx-enterprise
  364. # NOTE: for docker, only support latest otp version, not a matrix
  365. otp:
  366. - 24.1.5-3 # update to latest
  367. arch:
  368. - amd64
  369. - arm64
  370. steps:
  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. - uses: docker/setup-qemu-action@v1
  379. with:
  380. image: tonistiigi/binfmt:latest
  381. platforms: all
  382. - uses: docker/metadata-action@v3
  383. id: meta
  384. with:
  385. images: ${{ github.repository_owner }}/${{ matrix.profile }}
  386. flavor: |
  387. latest=${{ !github.event.release.prerelease }}
  388. tags: |
  389. type=ref,event=branch
  390. type=ref,event=pr
  391. type=ref,event=tag
  392. type=semver,pattern={{version}}
  393. labels:
  394. org.opencontainers.image.otp.version=${{ matrix.otp }}
  395. - uses: docker/login-action@v1
  396. if: github.event_name == 'release'
  397. with:
  398. username: ${{ secrets.DOCKER_HUB_USER }}
  399. password: ${{ secrets.DOCKER_HUB_TOKEN }}
  400. - name: Get deps git refs for cache
  401. id: deps-refs
  402. run: |
  403. cd source
  404. make ensure-rebar3
  405. sudo cp rebar3 /usr/local/bin/rebar3
  406. rebar3 get-deps
  407. RocksDBRef=$(erl -noshell -eval '{ok,Raw}=file:consult("rebar.lock"), {_Vsn, Deps}=hd(Raw), {_, {git, _Url, {ref, Ref}},_} = lists:keyfind(<<"rocksdb">>,1, Deps), io:format("~s",[Ref]), init:stop().')
  408. echo "::set-output name=DEP_ROCKSDB_REF::${RocksDBRef}"
  409. QuicerRef=$(erl -noshell -eval '{ok,Raw}=file:consult("rebar.lock"), {_Vsn, Deps}=hd(Raw), {_, {git, _Url, {ref, Ref}},_} = lists:keyfind(<<"quicer">>,1, Deps), io:format("~s",[Ref]), init:stop().')
  410. echo "::set-output name=DEP_QUICER_REF::${QuicerRef}"
  411. make clean-all
  412. - name: load rocksdb cache
  413. uses: actions/cache@v2
  414. with:
  415. path: source/_build/default/lib/rocksdb/
  416. key: alpine3.14-${{ matrix.otp }}-${{ matrix.arch }}-${{ steps.deps-refs.outputs.DEP_ROCKSDB_REF }}
  417. - name: load quicer cache
  418. uses: actions/cache@v2
  419. with:
  420. path: source/_build/default/lib/quicer/
  421. key: alpine3.14-${{ matrix.otp }}-${{ matrix.arch }}-${{ steps.deps-refs.outputs.DEP_QUICER_REF }}
  422. - uses: docker/build-push-action@v2
  423. with:
  424. push: ${{ github.event_name == 'release' && !github.event.release.prerelease }}
  425. pull: true
  426. no-cache: true
  427. platforms: linux/${{ matrix.arch }}
  428. tags: ${{ steps.meta.outputs.tags }}
  429. labels: ${{ steps.meta.outputs.labels }}
  430. build-args: |
  431. BUILD_FROM=ghcr.io/emqx/emqx-builder/5.0-3:${{ matrix.otp }}-alpine3.14
  432. RUN_FROM=alpine:3.14
  433. EMQX_NAME=${{ matrix.profile }}
  434. file: source/deploy/docker/Dockerfile
  435. context: source
  436. - uses: aws-actions/configure-aws-credentials@v1
  437. if: github.event_name == 'release' && !github.event.release.prerelease && matrix.profile == 'emqx'
  438. with:
  439. aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
  440. aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
  441. aws-region: ${{ secrets.AWS_DEFAULT_REGION }}
  442. - name: Push image to aws ecr
  443. if: github.event_name == 'release' && !github.event.release.prerelease && matrix.profile == 'emqx'
  444. run: |
  445. version=${GITHUB_REF##*/}
  446. docker pull emqx/emqx:${version#v}
  447. docker tag emqx/emqx:${version#v} public.ecr.aws/emqx/emqx:${version#v}
  448. aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws
  449. docker push public.ecr.aws/emqx/emqx:${version#v}
  450. delete-artifact:
  451. runs-on: ubuntu-20.04
  452. needs: [prepare, mac, linux, docker]
  453. steps:
  454. - uses: geekyeggo/delete-artifact@v1
  455. with:
  456. name: source
  457. upload:
  458. runs-on: ubuntu-20.04
  459. if: startsWith(github.ref, 'refs/tags/')
  460. needs: [prepare, mac, linux, docker]
  461. strategy:
  462. matrix:
  463. profile:
  464. - emqx-edge
  465. - emqx
  466. - emqx-enterprise
  467. otp:
  468. - 24.1.5-3
  469. steps:
  470. - uses: actions/checkout@v2
  471. - name: get_version
  472. run: |
  473. echo 'version<<EOF' >> $GITHUB_ENV
  474. echo ${{ github.ref }} | sed -r "s ^refs/heads/|^refs/tags/(.*) \1 g" >> $GITHUB_ENV
  475. echo 'EOF' >> $GITHUB_ENV
  476. - uses: actions/download-artifact@v2
  477. with:
  478. name: ${{ matrix.profile }}-${{ matrix.otp }}
  479. path: ./_packages/${{ matrix.profile }}
  480. - name: install dos2unix
  481. run: sudo apt-get update && sudo apt install -y dos2unix
  482. - name: get packages
  483. run: |
  484. set -e -u
  485. cd _packages/${{ matrix.profile }}
  486. for var in $( ls |grep emqx |grep -v sha256); do
  487. dos2unix $var.sha256
  488. echo "$(cat $var.sha256) $var" | sha256sum -c || exit 1
  489. done
  490. cd -
  491. - name: upload aws s3
  492. run: |
  493. set -e -u
  494. if [ "${{ matrix.profile }}" == "emqx" ];then
  495. broker="emqx-ce"
  496. else
  497. broker=${{ matrix.profile }}
  498. fi
  499. aws configure set aws_access_key_id ${{ secrets.AWS_ACCESS_KEY_ID }}
  500. aws configure set aws_secret_access_key ${{ secrets.AWS_SECRET_ACCESS_KEY }}
  501. aws configure set default.region ${{ secrets.AWS_DEFAULT_REGION }}
  502. aws s3 cp --recursive _packages/${{ matrix.profile }} s3://${{ secrets.AWS_S3_BUCKET }}/$broker/${{ env.version }}
  503. aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_CLOUDFRONT_ID }} --paths "/$broker/${{ env.version }}/*"
  504. - uses: Rory-Z/upload-release-asset@v1
  505. if: github.event_name == 'release'
  506. with:
  507. repo: emqx
  508. path: "_packages/${{ matrix.profile }}/emqx-*"
  509. token: ${{ github.token }}
  510. - name: update to emqx.io
  511. if: github.event_name == 'release'
  512. run: |
  513. set -e -x -u
  514. curl -w %{http_code} \
  515. --insecure \
  516. -H "Content-Type: application/json" \
  517. -H "token: ${{ secrets.EMQX_IO_TOKEN }}" \
  518. -X POST \
  519. -d "{\"repo\":\"emqx/emqx\", \"tag\": \"${{ env.version }}\" }" \
  520. ${{ secrets.EMQX_IO_RELEASE_API }}
  521. - name: update repo.emqx.io
  522. if: github.event_name == 'release'
  523. run: |
  524. if [ "${{ matrix.profile }}" = 'emqx-enterprise' ]; then
  525. BOOL_FLAG_NAME="emqx_ee"
  526. else
  527. BOOL_FLAG_NAME="emqx_ce"
  528. fi
  529. curl --silent --show-error \
  530. -H "Authorization: token ${{ secrets.CI_GIT_TOKEN }}" \
  531. -H "Accept: application/vnd.github.v3+json" \
  532. -X POST \
  533. -d "{\"ref\":\"v1.0.4\",\"inputs\":{\"version\": \"${{ env.version }}\", \"${BOOL_FLAG_NAME}\": \"true\"}}" \
  534. "https://api.github.com/repos/emqx/emqx-ci-helper/actions/workflows/update_emqx_repos.yaml/dispatches"
  535. - name: update homebrew packages
  536. if: github.event_name == 'release' && matrix.profile == 'emqx'
  537. run: |
  538. if [ -z $(echo $version | grep -oE "(alpha|beta|rc)\.[0-9]") ]; then
  539. curl --silent --show-error \
  540. -H "Authorization: token ${{ secrets.CI_GIT_TOKEN }}" \
  541. -H "Accept: application/vnd.github.v3+json" \
  542. -X POST \
  543. -d "{\"ref\":\"v1.0.4\",\"inputs\":{\"version\": \"${{ env.version }}\"}}" \
  544. "https://api.github.com/repos/emqx/emqx-ci-helper/actions/workflows/update_emqx_homebrew.yaml/dispatches"
  545. fi
  546. - uses: geekyeggo/delete-artifact@v1
  547. with:
  548. name: ${{ matrix.profile }}