From 69ce81e7f4f863f5cf963dbfdc71a8a5c80f0730 Mon Sep 17 00:00:00 2001 From: Lion - dapplion <35266934+dapplion@users.noreply.github.com> Date: Wed, 9 Mar 2022 22:19:32 +0530 Subject: [PATCH] Assert tag == local package.json version (#3840) * Fix RELEASE instructions * Assert tag == local package.json version --- .github/workflows/release.yml | 5 +++++ .../scripts/assert-same-package-version.sh | 19 +++++++++++++++++++ RELEASE.md | 4 ++-- 3 files changed, 26 insertions(+), 2 deletions(-) create mode 100755 .github/workflows/scripts/assert-same-package-version.sh diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8270e27be2..ab69f9a183 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -30,6 +30,11 @@ jobs: env: CURRENT_TAG: ${{ steps.get_tag.outputs.tag }} IGNORE_PATTERN: beta + + - name: Assert tag == package.json version + run: .github/workflows/scripts/assert-same-package-version.sh + env: + TAG: ${{ steps.get_tag.outputs.tag }} outputs: is_beta: ${{ contains(github.ref, 'beta') }} tag: ${{ steps.get_tag.outputs.tag }} diff --git a/.github/workflows/scripts/assert-same-package-version.sh b/.github/workflows/scripts/assert-same-package-version.sh new file mode 100755 index 0000000000..5dee55c5a2 --- /dev/null +++ b/.github/workflows/scripts/assert-same-package-version.sh @@ -0,0 +1,19 @@ +# Our current release strategy does not gurantee that the tagged commit +# has the same version in the package.json. +# +# If that's not the case, no version will be published to NPM and a faulty image will be published to dockerhub + +LOCAL_VERSION=$(jq -r .version lerna.json) + +if [ -z "$TAG" ]; then + echo "ENV TAG is empty" + exit 1 +fi + +if [[ $TAG == *"$LOCAL_VERSION"* ]]; then + echo "TAG $TAG includes LOCAL_VERSION $LOCAL_VERSION" + exit 0 +else + echo "TAG $TAG does not include LOCAL_VERSION $LOCAL_VERSION" + exit 1 +fi diff --git a/RELEASE.md b/RELEASE.md index 61bcf13850..7aa57c5b01 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -17,7 +17,7 @@ export TAG=v0.34.0-beta.0 && git tag -a $TAG 9fceb02 -m "$TAG" && git push origi 4. The team creates a PR to bump `master` to the next version (in the example: `v0.35.0`) and continues releasing nightly builds. ``` -lerna version minor --no-git-tag-version +lerna version minor --no-git-tag-version --force-publish ``` After 3-5 days of testing: @@ -25,7 +25,7 @@ After 3-5 days of testing: 5. Tag final stable commit as `v0.34.0`, release and publish the stable release. This commit will be in `v0.34.x` branch and may note be on `master` if beta candidate required bug fixes. ``` -export TAG=v0.34.0 git && tag -a $TAG 9fceb02 -m "$TAG" && git push origin $TAG +export TAG=v0.34.0 && git tag -a $TAG 9fceb02 -m "$TAG" && git push origin $TAG ``` ## Pre-Releases