release.yaml 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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. jobs:
  16. upload:
  17. runs-on: ubuntu-22.04
  18. strategy:
  19. fail-fast: false
  20. steps:
  21. - uses: aws-actions/configure-aws-credentials@v2
  22. with:
  23. aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
  24. aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
  25. aws-region: ${{ secrets.AWS_DEFAULT_REGION }}
  26. - uses: actions/checkout@v3
  27. with:
  28. ref: ${{ github.event.inputs.tag }}
  29. - name: Detect profile
  30. id: profile
  31. run: |
  32. if git describe --tags --match '[v|e]*' --exact; then
  33. REF=$(git describe --tags --match '[v|e]*' --exact)
  34. else
  35. echo "Only release tags matching '[v|e]*' are supported"
  36. exit 1
  37. fi
  38. case "$REF" in
  39. v*)
  40. echo "profile=emqx" >> $GITHUB_OUTPUT
  41. echo "version=$(./pkg-vsn.sh emqx)" >> $GITHUB_OUTPUT
  42. echo "s3dir=emqx-ce" >> $GITHUB_OUTPUT
  43. ;;
  44. e*)
  45. echo "profile=emqx-enterprise" >> $GITHUB_OUTPUT
  46. echo "version=$(./pkg-vsn.sh emqx-enterprise)" >> $GITHUB_OUTPUT
  47. echo "s3dir=emqx-ee" >> $GITHUB_OUTPUT
  48. ;;
  49. esac
  50. - name: Get packages
  51. run: |
  52. BUCKET=${{ secrets.AWS_S3_BUCKET }}
  53. OUTPUT_DIR=${{ steps.profile.outputs.s3dir }}
  54. aws s3 cp --recursive s3://$BUCKET/$OUTPUT_DIR/${{ github.ref_name }} packages
  55. - uses: alexellis/upload-assets@0.4.0
  56. env:
  57. GITHUB_TOKEN: ${{ github.token }}
  58. with:
  59. asset_paths: '["packages/*"]'
  60. - name: update to emqx.io
  61. if: startsWith(github.ref_name, 'v') && ((github.event_name == 'release' && !github.event.prerelease) || inputs.publish_release_artefacts)
  62. run: |
  63. set -eux
  64. curl -w %{http_code} \
  65. --insecure \
  66. -H "Content-Type: application/json" \
  67. -H "token: ${{ secrets.EMQX_IO_TOKEN }}" \
  68. -X POST \
  69. -d "{\"repo\":\"emqx/emqx\", \"tag\": \"${{ github.ref_name }}\" }" \
  70. ${{ secrets.EMQX_IO_RELEASE_API }}
  71. - name: Push to packagecloud.io
  72. if: (github.event_name == 'release' && !github.event.prerelease) || inputs.publish_release_artefacts
  73. env:
  74. PROFILE: ${{ steps.profile.outputs.profile }}
  75. VERSION: ${{ steps.profile.outputs.version }}
  76. PACKAGECLOUD_TOKEN: ${{ secrets.PACKAGECLOUD_TOKEN }}
  77. run: |
  78. set -eu
  79. REPO=$PROFILE
  80. if [ $PROFILE = 'emqx-enterprise' ]; then
  81. REPO='emqx-enterprise5'
  82. fi
  83. function push() {
  84. 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
  85. }
  86. push "debian/buster" "packages/$PROFILE-$VERSION-debian10-amd64.deb"
  87. push "debian/buster" "packages/$PROFILE-$VERSION-debian10-arm64.deb"
  88. push "debian/bullseye" "packages/$PROFILE-$VERSION-debian11-amd64.deb"
  89. push "debian/bullseye" "packages/$PROFILE-$VERSION-debian11-arm64.deb"
  90. push "debian/bookworm" "packages/$PROFILE-$VERSION-debian12-amd64.deb"
  91. push "debian/bookworm" "packages/$PROFILE-$VERSION-debian12-arm64.deb"
  92. push "ubuntu/bionic" "packages/$PROFILE-$VERSION-ubuntu18.04-amd64.deb"
  93. push "ubuntu/bionic" "packages/$PROFILE-$VERSION-ubuntu18.04-arm64.deb"
  94. push "ubuntu/focal" "packages/$PROFILE-$VERSION-ubuntu20.04-amd64.deb"
  95. push "ubuntu/focal" "packages/$PROFILE-$VERSION-ubuntu20.04-arm64.deb"
  96. push "ubuntu/jammy" "packages/$PROFILE-$VERSION-ubuntu22.04-amd64.deb"
  97. push "ubuntu/jammy" "packages/$PROFILE-$VERSION-ubuntu22.04-arm64.deb"
  98. push "el/7" "packages/$PROFILE-$VERSION-el7-amd64.rpm"
  99. push "el/7" "packages/$PROFILE-$VERSION-el7-arm64.rpm"
  100. push "el/8" "packages/$PROFILE-$VERSION-el8-amd64.rpm"
  101. push "el/8" "packages/$PROFILE-$VERSION-el8-arm64.rpm"
  102. push "el/9" "packages/$PROFILE-$VERSION-el9-amd64.rpm"
  103. push "el/9" "packages/$PROFILE-$VERSION-el9-arm64.rpm"
  104. push "amazon/2" "packages/$PROFILE-$VERSION-amzn2-amd64.rpm"
  105. push "amazon/2" "packages/$PROFILE-$VERSION-amzn2-arm64.rpm"
  106. push "amazon/2023" "packages/$PROFILE-$VERSION-amzn2023-amd64.rpm"
  107. push "amazon/2023" "packages/$PROFILE-$VERSION-amzn2023-arm64.rpm"
  108. rerun-apps-version-check:
  109. runs-on: ubuntu-22.04
  110. if: github.repository_owner == 'emqx' && github.event_name == 'release'
  111. needs:
  112. - upload
  113. permissions:
  114. pull-requests: read
  115. checks: write
  116. actions: write
  117. steps:
  118. - uses: actions/checkout@v3
  119. - name: trigger re-run of app versions check on open PRs
  120. shell: bash
  121. env:
  122. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  123. run: |
  124. python3 scripts/rerun-apps-version-check.py