release.yaml 2.8 KB

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