release.yaml 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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. matrix:
  12. profile:
  13. - emqx-edge
  14. - emqx
  15. - emqx-enterprise
  16. steps:
  17. - uses: aws-actions/configure-aws-credentials@v1
  18. with:
  19. aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
  20. aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
  21. aws-region: ${{ secrets.AWS_DEFAULT_REGION }}
  22. - name: Get packages
  23. run: |
  24. PROFILE=${{ matrix.profile }}
  25. if [ $PROFILE = 'emqx' ]; then
  26. s3dir='emqx-ce'
  27. elif [ $PROFILE = 'emqx-enterprise' ]; then
  28. s3dir='emqx-ee'
  29. elif [ $PROFILE = 'emqx-edge' ]; then
  30. s3dir='emqx-edge'
  31. else
  32. echo "unknown profile $PROFILE"
  33. exit 1
  34. fi
  35. aws s3 cp --recursive s3://${{ secrets.AWS_S3_BUCKET }}/$s3dir/${{ github.ref_name }} packages
  36. - uses: alexellis/upload-assets@0.2.2
  37. env:
  38. GITHUB_TOKEN: ${{ github.token }}
  39. with:
  40. asset_paths: '["packages/*"]'
  41. - name: update to emqx.io
  42. if: github.event_name == 'release'
  43. run: |
  44. set -e -x -u
  45. curl -w %{http_code} \
  46. --insecure \
  47. -H "Content-Type: application/json" \
  48. -H "token: ${{ secrets.EMQX_IO_TOKEN }}" \
  49. -X POST \
  50. -d "{\"repo\":\"emqx/emqx\", \"tag\": \"${{ github.ref_name }}\" }" \
  51. ${{ secrets.EMQX_IO_RELEASE_API }}
  52. - name: update repo.emqx.io
  53. if: github.event_name == 'release'
  54. run: |
  55. if [ "${{ matrix.profile }}" = 'emqx-enterprise' ]; then
  56. BOOL_FLAG_NAME="emqx_ee"
  57. else
  58. BOOL_FLAG_NAME="emqx_ce"
  59. fi
  60. curl --silent --show-error \
  61. -H "Authorization: token ${{ secrets.CI_GIT_TOKEN }}" \
  62. -H "Accept: application/vnd.github.v3+json" \
  63. -X POST \
  64. -d "{\"ref\":\"v1.0.4\",\"inputs\":{\"version\": \"${{ github.ref_name }}\", \"${BOOL_FLAG_NAME}\": \"true\"}}" \
  65. "https://api.github.com/repos/emqx/emqx-ci-helper/actions/workflows/update_emqx_repos.yaml/dispatches"
  66. - name: update homebrew packages
  67. if: github.event_name == 'release' && matrix.profile == 'emqx'
  68. run: |
  69. if [ -z $(echo $version | grep -oE "(alpha|beta|rc)\.[0-9]") ]; then
  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 }}\"}}" \
  75. "https://api.github.com/repos/emqx/emqx-ci-helper/actions/workflows/update_emqx_homebrew.yaml/dispatches"
  76. fi