diff --git a/.github/workflows/build_packages.yaml b/.github/workflows/build_packages.yaml index 2715c5ee6..19c04431e 100644 --- a/.github/workflows/build_packages.yaml +++ b/.github/workflows/build_packages.yaml @@ -361,9 +361,16 @@ jobs: run: sudo apt-get update && sudo apt install -y dos2unix - name: get packages run: | + DEFAULT_BEAM_PLATFORM='otp24.2.1-1' set -e -u cd packages/${{ matrix.profile }} - for var in $( ls |grep emqx |grep -v sha256); do + # Make a copy of the default OTP version package to a file without OTP version infix + while read -r fname; do + default_fname=$(echo "$fname" | sed "s/-${DEFAULT_BEAM_PLATFORM}//g") + echo "$fname -> $default_fname" + cp "$fname" "$default_fname" + done < <(find . -maxdepth 1 -type f | grep -E "emqx(-enterprise)?-5\.[0-9]+\.[0-9]+.*-${DEFAULT_BEAM_PLATFORM}" | grep -v elixir) + for var in $(ls | grep emqx | grep -v sha256); do dos2unix $var.sha256 echo "$(cat $var.sha256) $var" | sha256sum -c || exit 1 done diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 9ca319a0e..b18a4476e 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -9,11 +9,6 @@ jobs: runs-on: ubuntu-20.04 strategy: fail-fast: false - matrix: - profile: - - emqx - - emqx-enterprise - steps: - uses: aws-actions/configure-aws-credentials@v1 with: @@ -22,16 +17,29 @@ jobs: aws-region: ${{ secrets.AWS_DEFAULT_REGION }} - name: Get packages run: | - PROFILE=${{ matrix.profile }} - if [ $PROFILE = 'emqx' ]; then + REF=${{ github.ref_name }} + case "$REF" in + v*) s3dir='emqx-ce' - elif [ $PROFILE = 'emqx-enterprise' ]; then + ;; + e*) s3dir='emqx-ee' - else - echo "unknown profile $PROFILE" + ;; + *) + echo "tag $REF is not supported" exit 1 fi aws s3 cp --recursive s3://${{ secrets.AWS_S3_BUCKET }}/$s3dir/${{ github.ref_name }} packages + cd packages + DEFAULT_BEAM_PLATFORM='otp24.2.1-1' + # all packages including full-name and default-name are uploaded to s3 + # but we only upload default-name packages (and elixir) as github artifacts + # so we rename (overwrite) non-default packages before uploading + while read -r fname; do + default_fname=$(echo "$fname" | sed "s/-${DEFAULT_BEAM_PLATFORM}//g") + echo "$fname -> $default_fname" + mv -f "$fname" "$default_fname" + done < <(find . -maxdepth 1 -type f | grep -E "emqx(-enterprise)?-5\.[0-9]+\.[0-9]+.*-${DEFAULT_BEAM_PLATFORM}" | grep -v elixir) - uses: alexellis/upload-assets@0.2.2 env: GITHUB_TOKEN: ${{ github.token }} @@ -51,11 +59,15 @@ jobs: - name: update repo.emqx.io if: github.event_name == 'release' run: | - if [ "${{ matrix.profile }}" = 'emqx-enterprise' ]; then - BOOL_FLAG_NAME="emqx_ee" - else - BOOL_FLAG_NAME="emqx_ce" - fi + REF=${{ github.ref_name }} + case "$REF" in + v*) + BOOL_FLAG_NAME="emqx_ce" + ;; + e*) + BOOL_FLAG_NAME="emqx_ee" + ;; + esac curl --silent --show-error \ -H "Authorization: token ${{ secrets.CI_GIT_TOKEN }}" \ -H "Accept: application/vnd.github.v3+json" \ @@ -63,8 +75,18 @@ jobs: -d "{\"ref\":\"v1.0.4\",\"inputs\":{\"version\": \"${{ github.ref_name }}\", \"${BOOL_FLAG_NAME}\": \"true\"}}" \ "https://api.github.com/repos/emqx/emqx-ci-helper/actions/workflows/update_emqx_repos.yaml/dispatches" - name: update homebrew packages - if: github.event_name == 'release' && matrix.profile == 'emqx' + if: github.event_name == 'release' run: | + REF=${{ github.ref_name }} + case "$REF" in + v*) + BOOL_FLAG_NAME="emqx_ce" + ;; + e*) + echo "Not updating homebrew for enterprise eidition" + exit 0 + ;; + esac if [ -z $(echo $version | grep -oE "(alpha|beta|rc)\.[0-9]") ]; then curl --silent --show-error \ -H "Authorization: token ${{ secrets.CI_GIT_TOKEN }}" \ diff --git a/pkg-vsn.sh b/pkg-vsn.sh index cdf68b5b6..20eead6f7 100755 --- a/pkg-vsn.sh +++ b/pkg-vsn.sh @@ -11,7 +11,8 @@ help() { echo "$0 PROFILE [options]" echo echo "-h|--help: To display this usage information" - echo "--long: Print log vsn number. e.g. 5.0.0-otp24.2.1-1-ubuntu20.04-amd64" + echo "--default: Print default vsn number. e.g. e.g. 5.0.0-ubuntu20.04-amd64" + echo "--long: Print long vsn number. e.g. 5.0.0-otp24.2.1-1-ubuntu20.04-amd64" echo " Otherwise short e.g. 5.0.0" echo "--elixir: Include elixir version in the long version string" echo " e.g. 5.0.0-elixir1.13.4-otp24.2.1-1-ubuntu20.04-amd64" @@ -33,6 +34,10 @@ while [ "$#" -gt 0 ]; do help exit 0 ;; + --default) + IS_DEFAULT_RELEASE='yes' + shift 1 + ;; --long) LONG_VERSION='yes' shift 1 @@ -115,6 +120,20 @@ fi OTP_VSN="${OTP_VSN:-$(./scripts/get-otp-vsn.sh)}" SYSTEM="$(./scripts/get-distro.sh)" +if [ "${PKG_VSN:-}" = 'v5.0.0' ]; then + # 5.0.0 is released only with a full name package + # e.g. 5.0.0-otp24.2.1-1-ubuntu20.04-amd64 + case "$SYSTEM" in + windows*) + ## alway directly build the default package for windows + IS_DEFAULT_RELEASE='yes' + ;; + *) + true + ;; + esac +fi + UNAME="$(uname -m)" case "$UNAME" in x86_64) @@ -128,11 +147,15 @@ case "$UNAME" in ;; esac -if [ "${IS_ELIXIR:-}" = "yes" ]; then - ELIXIR_VSN="${ELIXIR_VSN:-$(./scripts/get-elixir-vsn.sh)}" - FULL_VSN="${PKG_VSN}-elixir${ELIXIR_VSN}-otp${OTP_VSN}-${SYSTEM}-${ARCH}" +if [ "${IS_DEFAULT_RELEASE:-not-default-release}" = 'yes' ]; then + # when it's the default release, we do not add elixir or otp version + infix='' else - FULL_VSN="${PKG_VSN}-otp${OTP_VSN}-${SYSTEM}-${ARCH}" + infix="-otp${OTP_VSN}" + if [ "${IS_ELIXIR:-}" = "yes" ]; then + ELIXIR_VSN="${ELIXIR_VSN:-$(./scripts/get-elixir-vsn.sh)}" + infix="-elixir${ELIXIR_VSN}${infix}" + fi fi -echo "${FULL_VSN}" +echo "${PKG_VSN}${infix}-${SYSTEM}-${ARCH}"