release.yaml 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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_artefacts:
  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@v2
  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@v3
  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 "s3dir=emqx-ce" >> $GITHUB_OUTPUT
  54. ;;
  55. e*)
  56. echo "profile=emqx-enterprise" >> $GITHUB_OUTPUT
  57. echo "version=$(./pkg-vsn.sh emqx-enterprise)" >> $GITHUB_OUTPUT
  58. echo "s3dir=emqx-ee" >> $GITHUB_OUTPUT
  59. ;;
  60. esac
  61. - name: Get packages
  62. run: |
  63. BUCKET=${{ secrets.AWS_S3_BUCKET }}
  64. OUTPUT_DIR=${{ steps.profile.outputs.s3dir }}
  65. aws s3 cp --recursive s3://$BUCKET/$OUTPUT_DIR/${{ github.ref_name }} packages
  66. - uses: alexellis/upload-assets@0.4.0
  67. env:
  68. GITHUB_TOKEN: ${{ github.token }}
  69. with:
  70. asset_paths: '["packages/*"]'
  71. - name: update to emqx.io
  72. if: startsWith(github.ref_name, 'v') && ((github.event_name == 'release' && !github.event.release.prerelease) || inputs.publish_release_artefacts)
  73. run: |
  74. set -eux
  75. curl -w %{http_code} \
  76. --insecure \
  77. -H "Content-Type: application/json" \
  78. -H "token: ${{ secrets.EMQX_IO_TOKEN }}" \
  79. -X POST \
  80. -d "{\"repo\":\"emqx/emqx\", \"tag\": \"${{ github.ref_name }}\" }" \
  81. ${{ secrets.EMQX_IO_RELEASE_API }}
  82. - name: Push to packagecloud.io
  83. if: (github.event_name == 'release' && !github.event.release.prerelease) || inputs.publish_release_artefacts
  84. env:
  85. PROFILE: ${{ steps.profile.outputs.profile }}
  86. VERSION: ${{ steps.profile.outputs.version }}
  87. PACKAGECLOUD_TOKEN: ${{ secrets.PACKAGECLOUD_TOKEN }}
  88. run: |
  89. set -eu
  90. REPO=$PROFILE
  91. if [ $PROFILE = 'emqx-enterprise' ]; then
  92. REPO='emqx-enterprise5'
  93. fi
  94. function push() {
  95. 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
  96. }
  97. push "debian/buster" "packages/$PROFILE-$VERSION-debian10-amd64.deb"
  98. push "debian/buster" "packages/$PROFILE-$VERSION-debian10-arm64.deb"
  99. push "debian/bullseye" "packages/$PROFILE-$VERSION-debian11-amd64.deb"
  100. push "debian/bullseye" "packages/$PROFILE-$VERSION-debian11-arm64.deb"
  101. push "debian/bookworm" "packages/$PROFILE-$VERSION-debian12-amd64.deb"
  102. push "debian/bookworm" "packages/$PROFILE-$VERSION-debian12-arm64.deb"
  103. push "ubuntu/bionic" "packages/$PROFILE-$VERSION-ubuntu18.04-amd64.deb"
  104. push "ubuntu/bionic" "packages/$PROFILE-$VERSION-ubuntu18.04-arm64.deb"
  105. push "ubuntu/focal" "packages/$PROFILE-$VERSION-ubuntu20.04-amd64.deb"
  106. push "ubuntu/focal" "packages/$PROFILE-$VERSION-ubuntu20.04-arm64.deb"
  107. push "ubuntu/jammy" "packages/$PROFILE-$VERSION-ubuntu22.04-amd64.deb"
  108. push "ubuntu/jammy" "packages/$PROFILE-$VERSION-ubuntu22.04-arm64.deb"
  109. push "el/7" "packages/$PROFILE-$VERSION-el7-amd64.rpm"
  110. push "el/7" "packages/$PROFILE-$VERSION-el7-arm64.rpm"
  111. push "el/8" "packages/$PROFILE-$VERSION-el8-amd64.rpm"
  112. push "el/8" "packages/$PROFILE-$VERSION-el8-arm64.rpm"
  113. push "el/9" "packages/$PROFILE-$VERSION-el9-amd64.rpm"
  114. push "el/9" "packages/$PROFILE-$VERSION-el9-arm64.rpm"
  115. push "amazon/2" "packages/$PROFILE-$VERSION-amzn2-amd64.rpm"
  116. push "amazon/2" "packages/$PROFILE-$VERSION-amzn2-arm64.rpm"
  117. push "amazon/2023" "packages/$PROFILE-$VERSION-amzn2023-amd64.rpm"
  118. push "amazon/2023" "packages/$PROFILE-$VERSION-amzn2023-arm64.rpm"
  119. rerun-apps-version-check:
  120. runs-on: ubuntu-22.04
  121. if: github.repository_owner == 'emqx' && github.event_name == 'release'
  122. needs:
  123. - upload
  124. permissions:
  125. pull-requests: read
  126. checks: write
  127. actions: write
  128. steps:
  129. - uses: actions/checkout@v3
  130. - name: trigger re-run of app versions check on open PRs
  131. shell: bash
  132. env:
  133. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  134. run: |
  135. python3 scripts/rerun-apps-version-check.py