Merge pull request #8366 from zmstone/0630-release-default-packages-without-otp-elixir-in-name

build: release default package names
This commit is contained in:
Zaiming (Stone) Shi 2022-07-01 07:50:03 +01:00 committed by GitHub
commit 9ea28cf093
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 75 additions and 23 deletions

View File

@ -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

View File

@ -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 }}" \

View File

@ -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}"