release.yaml 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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-node16
  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. ;;
  31. esac
  32. aws s3 cp --recursive s3://${{ secrets.AWS_S3_BUCKET }}/$s3dir/${{ github.ref_name }} packages
  33. cd packages
  34. DEFAULT_BEAM_PLATFORM='otp24.2.1-1'
  35. # all packages including full-name and default-name are uploaded to s3
  36. # but we only upload default-name packages (and elixir) as github artifacts
  37. # so we rename (overwrite) non-default packages before uploading
  38. while read -r fname; do
  39. default_fname=$(echo "$fname" | sed "s/-${DEFAULT_BEAM_PLATFORM}//g")
  40. echo "$fname -> $default_fname"
  41. mv -f "$fname" "$default_fname"
  42. done < <(find . -maxdepth 1 -type f | grep -E "emqx(-enterprise)?-5\.[0-9]+\.[0-9]+.*-${DEFAULT_BEAM_PLATFORM}" | grep -v elixir)
  43. - uses: alexellis/upload-assets@0.4.0
  44. env:
  45. GITHUB_TOKEN: ${{ github.token }}
  46. with:
  47. asset_paths: '["packages/*"]'
  48. - name: update to emqx.io
  49. if: github.event_name == 'release'
  50. run: |
  51. set -e -x -u
  52. curl -w %{http_code} \
  53. --insecure \
  54. -H "Content-Type: application/json" \
  55. -H "token: ${{ secrets.EMQX_IO_TOKEN }}" \
  56. -X POST \
  57. -d "{\"repo\":\"emqx/emqx\", \"tag\": \"${{ github.ref_name }}\" }" \
  58. ${{ secrets.EMQX_IO_RELEASE_API }}
  59. - name: update homebrew packages
  60. if: github.event_name == 'release'
  61. run: |
  62. REF=${{ github.ref_name }}
  63. case "$REF" in
  64. v*)
  65. BOOL_FLAG_NAME="emqx_ce"
  66. ;;
  67. e*)
  68. echo "Not updating homebrew for enterprise eidition"
  69. exit 0
  70. ;;
  71. esac
  72. if [ -z $(echo $version | grep -oE "(alpha|beta|rc)\.[0-9]") ]; then
  73. curl --silent --show-error \
  74. -H "Authorization: token ${{ secrets.CI_GIT_TOKEN }}" \
  75. -H "Accept: application/vnd.github.v3+json" \
  76. -X POST \
  77. -d "{\"ref\":\"v1.0.4\",\"inputs\":{\"version\": \"${{ github.ref_name }}\"}}" \
  78. "https://api.github.com/repos/emqx/emqx-ci-helper/actions/workflows/update_emqx_homebrew.yaml/dispatches"
  79. fi
  80. upload-helm:
  81. runs-on: ubuntu-20.04
  82. if: github.event_name == 'release'
  83. strategy:
  84. fail-fast: false
  85. steps:
  86. - uses: actions/checkout@v3
  87. with:
  88. ref: ${{ github.ref }
  89. - uses: emqx/push-helm-action@v1
  90. if: startsWith(github.ref_name, 'v')
  91. with:
  92. charts_dir: "${{ github.workspace }}/deploy/charts/emqx"
  93. version: ${{ github.ref_name }}
  94. aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
  95. aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
  96. aws_region: "us-west-2"
  97. aws_bucket_name: "repos-emqx-io"
  98. - uses: emqx/push-helm-action@v1
  99. if: startsWith(github.ref_name, 'e')
  100. with:
  101. charts_dir: "${{ github.workspace }}/deploy/charts/emqx-enterprise"
  102. version: ${{ github.ref_name }}
  103. aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
  104. aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
  105. aws_region: "us-west-2"
  106. aws_bucket_name: "repos-emqx-io"