release.yaml 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. name: Upload release assets
  2. on:
  3. release:
  4. types:
  5. - published
  6. workflow_dispatch:
  7. inputs:
  8. tag:
  9. type: string
  10. required: true
  11. publish_release_artifacts:
  12. type: boolean
  13. required: true
  14. default: false
  15. permissions:
  16. contents: read
  17. jobs:
  18. upload:
  19. runs-on: ubuntu-22.04
  20. permissions:
  21. contents: write
  22. checks: write
  23. packages: write
  24. actions: read
  25. issues: read
  26. pull-requests: read
  27. repository-projects: read
  28. statuses: read
  29. strategy:
  30. fail-fast: false
  31. steps:
  32. - uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2
  33. with:
  34. aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
  35. aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
  36. aws-region: ${{ secrets.AWS_DEFAULT_REGION }}
  37. - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
  38. with:
  39. ref: ${{ github.event.inputs.tag }}
  40. - name: Detect profile
  41. id: profile
  42. run: |
  43. if git describe --tags --match '[v|e]*' --exact; then
  44. REF=$(git describe --tags --match '[v|e]*' --exact)
  45. else
  46. echo "Only release tags matching '[v|e]*' are supported"
  47. exit 1
  48. fi
  49. case "$REF" in
  50. v*)
  51. echo "profile=emqx" >> $GITHUB_OUTPUT
  52. echo "version=$(./pkg-vsn.sh emqx)" >> $GITHUB_OUTPUT
  53. echo "ref_name=v$(./pkg-vsn.sh emqx)" >> "$GITHUB_ENV"
  54. echo "s3dir=emqx-ce" >> $GITHUB_OUTPUT
  55. ;;
  56. e*)
  57. echo "profile=emqx-enterprise" >> $GITHUB_OUTPUT
  58. echo "version=$(./pkg-vsn.sh emqx-enterprise)" >> $GITHUB_OUTPUT
  59. echo "ref_name=e$(./pkg-vsn.sh emqx-enterprise)" >> "$GITHUB_ENV"
  60. echo "s3dir=emqx-ee" >> $GITHUB_OUTPUT
  61. ;;
  62. esac
  63. - name: Get packages
  64. run: |
  65. BUCKET=${{ secrets.AWS_S3_BUCKET }}
  66. OUTPUT_DIR=${{ steps.profile.outputs.s3dir }}
  67. aws s3 cp --recursive s3://$BUCKET/$OUTPUT_DIR/${{ env.ref_name }} packages
  68. - uses: emqx/upload-assets@974befcf0e72a1811360a81c798855efb66b0551 # 0.5.2
  69. env:
  70. GITHUB_TOKEN: ${{ github.token }}
  71. with:
  72. asset_paths: '["packages/*"]'
  73. tag_name: "${{ env.ref_name }}"
  74. skip_existing: true
  75. - name: update to emqx.io
  76. if: github.event_name == 'release' || inputs.publish_release_artifacts
  77. run: |
  78. set -eux
  79. curl -w %{http_code} \
  80. --insecure \
  81. -H "Content-Type: application/json" \
  82. -H "token: ${{ secrets.EMQX_IO_TOKEN }}" \
  83. -X POST \
  84. -d "{\"repo\":\"emqx/emqx\", \"tag\": \"${{ env.ref_name }}\" }" \
  85. ${{ secrets.EMQX_IO_RELEASE_API }}
  86. - name: Push to packagecloud.io
  87. if: (github.event_name == 'release' && !github.event.release.prerelease) || inputs.publish_release_artifacts
  88. env:
  89. PROFILE: ${{ steps.profile.outputs.profile }}
  90. VERSION: ${{ steps.profile.outputs.version }}
  91. PACKAGECLOUD_TOKEN: ${{ secrets.PACKAGECLOUD_TOKEN }}
  92. run: |
  93. set -eu
  94. REPO=$PROFILE
  95. if [ $PROFILE = 'emqx-enterprise' ]; then
  96. REPO='emqx-enterprise5'
  97. fi
  98. function push() {
  99. docker run -t --rm -e PACKAGECLOUD_TOKEN=$PACKAGECLOUD_TOKEN -v $(pwd)/$2:/w/$2 -w /w ghcr.io/emqx/package_cloud push emqx/$REPO/$1 $2
  100. }
  101. push "debian/buster" "packages/$PROFILE-$VERSION-debian10-amd64.deb"
  102. push "debian/buster" "packages/$PROFILE-$VERSION-debian10-arm64.deb"
  103. push "debian/bullseye" "packages/$PROFILE-$VERSION-debian11-amd64.deb"
  104. push "debian/bullseye" "packages/$PROFILE-$VERSION-debian11-arm64.deb"
  105. push "debian/bookworm" "packages/$PROFILE-$VERSION-debian12-amd64.deb"
  106. push "debian/bookworm" "packages/$PROFILE-$VERSION-debian12-arm64.deb"
  107. push "ubuntu/focal" "packages/$PROFILE-$VERSION-ubuntu20.04-amd64.deb"
  108. push "ubuntu/focal" "packages/$PROFILE-$VERSION-ubuntu20.04-arm64.deb"
  109. push "ubuntu/jammy" "packages/$PROFILE-$VERSION-ubuntu22.04-amd64.deb"
  110. push "ubuntu/jammy" "packages/$PROFILE-$VERSION-ubuntu22.04-arm64.deb"
  111. push "ubuntu/noble" "packages/$PROFILE-$VERSION-ubuntu24.04-amd64.deb"
  112. push "ubuntu/noble" "packages/$PROFILE-$VERSION-ubuntu24.04-arm64.deb"
  113. push "el/7" "packages/$PROFILE-$VERSION-el7-amd64.rpm"
  114. push "el/7" "packages/$PROFILE-$VERSION-el7-arm64.rpm"
  115. push "el/8" "packages/$PROFILE-$VERSION-el8-amd64.rpm"
  116. push "el/8" "packages/$PROFILE-$VERSION-el8-arm64.rpm"
  117. push "el/9" "packages/$PROFILE-$VERSION-el9-amd64.rpm"
  118. push "el/9" "packages/$PROFILE-$VERSION-el9-arm64.rpm"
  119. push "amazon/2" "packages/$PROFILE-$VERSION-amzn2-amd64.rpm"
  120. push "amazon/2" "packages/$PROFILE-$VERSION-amzn2-arm64.rpm"
  121. push "amazon/2023" "packages/$PROFILE-$VERSION-amzn2023-amd64.rpm"
  122. push "amazon/2023" "packages/$PROFILE-$VERSION-amzn2023-arm64.rpm"