release.yaml 3.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. name: Upload release assets
  2. on:
  3. release:
  4. types:
  5. - published
  6. jobs:
  7. upload:
  8. runs-on: ubuntu-20.04
  9. strategy:
  10. fail-fast: false
  11. steps:
  12. - uses: aws-actions/configure-aws-credentials@v1
  13. with:
  14. aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
  15. aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
  16. aws-region: ${{ secrets.AWS_DEFAULT_REGION }}
  17. - name: Get packages
  18. run: |
  19. REF=${{ github.ref_name }}
  20. case "$REF" in
  21. v*)
  22. s3dir='emqx-ce'
  23. ;;
  24. e*)
  25. s3dir='emqx-ee'
  26. ;;
  27. *)
  28. echo "tag $REF is not supported"
  29. exit 1
  30. fi
  31. aws s3 cp --recursive s3://${{ secrets.AWS_S3_BUCKET }}/$s3dir/${{ github.ref_name }} packages
  32. cd packages
  33. DEFAULT_BEAM_PLATFORM='otp24.2.1-1'
  34. # all packages including full-name and default-name are uploaded to s3
  35. # but we only upload default-name packages (and elixir) as github artifacts
  36. # so we rename (overwrite) non-default packages before uploading
  37. while read -r fname; do
  38. default_fname=$(echo "$fname" | sed "s/-${DEFAULT_BEAM_PLATFORM}//g")
  39. echo "$fname -> $default_fname"
  40. mv -f "$fname" "$default_fname"
  41. done < <(find . -maxdepth 1 -type f | grep -E "emqx(-enterprise)?-5\.[0-9]+\.[0-9]+.*-${DEFAULT_BEAM_PLATFORM}" | grep -v elixir)
  42. - uses: alexellis/upload-assets@0.2.2
  43. env:
  44. GITHUB_TOKEN: ${{ github.token }}
  45. with:
  46. asset_paths: '["packages/*"]'
  47. - name: update to emqx.io
  48. if: github.event_name == 'release'
  49. run: |
  50. set -e -x -u
  51. curl -w %{http_code} \
  52. --insecure \
  53. -H "Content-Type: application/json" \
  54. -H "token: ${{ secrets.EMQX_IO_TOKEN }}" \
  55. -X POST \
  56. -d "{\"repo\":\"emqx/emqx\", \"tag\": \"${{ github.ref_name }}\" }" \
  57. ${{ secrets.EMQX_IO_RELEASE_API }}
  58. - name: update repo.emqx.io
  59. if: github.event_name == 'release'
  60. run: |
  61. REF=${{ github.ref_name }}
  62. case "$REF" in
  63. v*)
  64. BOOL_FLAG_NAME="emqx_ce"
  65. ;;
  66. e*)
  67. BOOL_FLAG_NAME="emqx_ee"
  68. ;;
  69. esac
  70. curl --silent --show-error \
  71. -H "Authorization: token ${{ secrets.CI_GIT_TOKEN }}" \
  72. -H "Accept: application/vnd.github.v3+json" \
  73. -X POST \
  74. -d "{\"ref\":\"v1.0.4\",\"inputs\":{\"version\": \"${{ github.ref_name }}\", \"${BOOL_FLAG_NAME}\": \"true\"}}" \
  75. "https://api.github.com/repos/emqx/emqx-ci-helper/actions/workflows/update_emqx_repos.yaml/dispatches"
  76. - name: update homebrew packages
  77. if: github.event_name == 'release'
  78. run: |
  79. REF=${{ github.ref_name }}
  80. case "$REF" in
  81. v*)
  82. BOOL_FLAG_NAME="emqx_ce"
  83. ;;
  84. e*)
  85. echo "Not updating homebrew for enterprise eidition"
  86. exit 0
  87. ;;
  88. esac
  89. if [ -z $(echo $version | grep -oE "(alpha|beta|rc)\.[0-9]") ]; then
  90. curl --silent --show-error \
  91. -H "Authorization: token ${{ secrets.CI_GIT_TOKEN }}" \
  92. -H "Accept: application/vnd.github.v3+json" \
  93. -X POST \
  94. -d "{\"ref\":\"v1.0.4\",\"inputs\":{\"version\": \"${{ github.ref_name }}\"}}" \
  95. "https://api.github.com/repos/emqx/emqx-ci-helper/actions/workflows/update_emqx_homebrew.yaml/dispatches"
  96. fi