Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: associate a commit with beta release #5530

Merged
34 changes: 31 additions & 3 deletions chore/release-beta.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,45 @@ echo "NEW_BETA_NUMBER $NEW_BETA_NUMBER"
NEXT_VERSION="$CURRENT_VERSION-beta-$NEW_BETA_NUMBER"
echo "::endgroup::"

echo "::group::Setting release version"
BRANCH_NAME="beta-release/$NEXT_VERSION"

echo "::group::Setting beta-release version"
mvn -f spoon-pom --no-transfer-progress --batch-mode versions:set -DnewVersion="$NEXT_VERSION" -DprocessAllModules
mvn --no-transfer-progress --batch-mode versions:set -DnewVersion="$NEXT_VERSION" -DprocessAllModules
mvn -f spoon-javadoc --no-transfer-progress --batch-mode versions:set -DnewVersion="$NEXT_VERSION" -DprocessAllModules
echo "::endgroup::"

echo "::group::Staging release"
echo "::group::Commit & Push changes"
git checkout -b "$BRANCH_NAME"
git commit -am "release: Releasing version $NEXT_VERSION"
git push --set-upstream origin "$BRANCH_NAME"
echo "::endgroup::"

echo "::group::Staging beta-release"
mvn -f spoon-pom --no-transfer-progress --batch-mode -Pjreleaser clean deploy -DaltDeploymentRepository=local::default::file:./target/staging-deploy
mvn --no-transfer-progress --batch-mode -Pjreleaser deploy:deploy-file -Dfile="./spoon-pom/pom.xml" -DpomFile="./spoon-pom/pom.xml" -Durl="file://$(mvn help:evaluate -D"expression=project.basedir" -q -DforceStdout)/target/staging-deploy"
echo "::endgroup::"

echo "::group::Running jreleaser"
JRELEASER_PROJECT_VERSION="$NEXT_VERSION" jreleaser-cli deploy
JRELEASER_PROJECT_VERSION="$NEXT_VERSION" jreleaser-cli release
echo "::endgroup::"

# Set next version (patch of release version) with -SNAPSHOT suffix
NEXT_RELEASE_VERSION=$CURRENT_VERSION_WITH_SNAPSHOT

echo "::group::Updating poms to next target version"
mvn -f spoon-pom --no-transfer-progress --batch-mode versions:set -DnewVersion="$NEXT_RELEASE_VERSION" -DprocessAllModules
mvn --no-transfer-progress --batch-mode versions:set -DnewVersion="$NEXT_RELEASE_VERSION" -DprocessAllModules
mvn -f spoon-javadoc --no-transfer-progress --batch-mode versions:set -DnewVersion="$NEXT_RELEASE_VERSION" -DprocessAllModules
echo "::endgroup::"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I can see you do not actually update anything as NEXT_RELEASE_VERSION is already identical to whatever was there originally?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah wait, it was changed in between, the messages and names are just confusing. Maybe just drop NEXT_RELEASE_VERSION and rename CURRENT_VERSION to ORIGINAL_VERSION and then use that variable here. And update the messages to say that you are reverting to the old version and not the next target.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NEXT_VERSION is the beta version for which the commit needs to be pushed. So I push the commit, after rewritting POMs, in R30-R42.

Next is NEXT_RELEASE_VERSION which is the SNAPSHOT. It will be the same version before the beta version as we don't have SNAPSHOT versions for beta as well. The name of this variable is confusing, a better name would be SNAPSHOT_VERSION_TO_RESET_TO.

P.S. Sorry I did not notice your reviews earlier.


echo "::group::Committing changes"
git commit -am "release: Setting SNAPSHOT version back to $NEXT_RELEASE_VERSION"
git push --set-upstream origin "$BRANCH_NAME"
echo "::endgroup::"

echo "::group::Merging into master (fast-forward)"
git checkout master
git merge --ff-only "$BRANCH_NAME"
git push origin master
I-Al-Istannen marked this conversation as resolved.
Show resolved Hide resolved
echo "::endgroup::"