Skip to content

Commit

Permalink
Merge pull request #1746 from jponge/build/improve-release-scripts
Browse files Browse the repository at this point in the history
build(release): improve the scripts to handle pre and final releases
  • Loading branch information
jponge authored Nov 22, 2024
2 parents 4b0e0af + d057901 commit daa585c
Showing 1 changed file with 44 additions and 10 deletions.
54 changes: 44 additions & 10 deletions justfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
#!/usr/bin/env just --justfile

set shell := ["bash", "-uc"]

# Do a quick build
quick-build:
./mvnw -Dquickly

# Maven install
install:
./mvnw clean install


# Run all the tests
verify:
./mvnw verify -Pparallel-tests -T8
Expand All @@ -21,38 +28,65 @@ prepare-release previousVersion version:
./mvnw --batch-mode --no-transfer-progress -Pupdate-workshop-examples -f workshop-examples compile -DworkshopVersion={{version}}
find workshop-examples -name '*.java' | xargs chmod +x
git commit -am "chore(release): update version metadata for Mutiny {{version}}"
just changelog
@echo "✅ All set, please review the changes on this branch before doing the release, then:"
@echo " - git push origin release/{{version}} --set-upstream"
@echo " - just perform-release"

# Perform a release
perform-release:
# Compute a changelog
changelog:
#!/usr/bin/env bash
export PREVIOUS_VERSION=$(yq '.release.previous-version' .github/project.yml)
export RELEASE_VERSION=$(yq '.release.current-version' .github/project.yml)
export NEXT_VERSION=$(yq '.release.next-version' .github/project.yml)
echo "🚀 Releasing: ${PREVIOUS_VERSION} ➡️ ${RELEASE_VERSION} ➡️ ${NEXT_VERSION}"
export JRELEASER_GITHUB_TOKEN=$(gh auth token)
export JRELEASER_PROJECT_VERSION=${RELEASE_VERSION}
export JRELEASER_TAG_NAME=${RELEASE_VERSION}
export JRELEASER_PREVIOUS_TAG_NAME=${PREVIOUS_VERSION}
export JRELEASER_BRANCH="release/${RELEASE_VERSION}"
./mvnw --batch-mode --no-transfer-progress -Pjreleaser jreleaser:changelog -pl :mutiny-project
echo "✅ Release notes ok"
echo "✅ Release notes ok, check target/jreleaser/release/CHANGELOG.md"
# Perform a release
perform-release:
#!/usr/bin/env bash
export PREVIOUS_VERSION=$(yq '.release.previous-version' .github/project.yml)
export RELEASE_VERSION=$(yq '.release.current-version' .github/project.yml)
export NEXT_VERSION=$(yq '.release.next-version' .github/project.yml)
export RELEASE_BRANCH="release/${RELEASE_VERSION}"
echo "🚀 Releasing: ${PREVIOUS_VERSION} ➡️ ${RELEASE_VERSION} ➡️ ${NEXT_VERSION}"
pre_release=0
gh_extra_args=""
case "${RELEASE_VERSION}" in
*-RC*)
pre_release=1
gh_extra_args="${gh_extra_args} --pre_release --latest=false"
;;
*-M*)
pre_release=1
gh_extra_args="${gh_extra_args} --pre_release --latest=false"
;;
esac
if [[ pre_release -eq 1 ]]; then
echo '🧪 This is a pre-release'
fi
gh release create ${RELEASE_VERSION} \
--discussion-category 'Announcements' \
--notes-file target/jreleaser/release/CHANGELOG.md \
--target ${JRELEASER_BRANCH} \
--prerelease --latest=false
--target ${RELEASE_BRANCH} \
${gh_extra_args}
echo "✅ Release created"
./mvnw --batch-mode --no-transfer-progress versions:set -DnewVersion=${NEXT_VERSION} -DgenerateBackupPoms=false
./mvnw --batch-mode --no-transfer-progress versions:set -DnewVersion=${NEXT_VERSION} -DgenerateBackupPoms=false -pl bom
git commit -am "chore(release): set development version to ${NEXT_VERSION}"
just clear-revapi
echo "✅ All set, don't forget to merge this branch and push upstream."
if [[ pre_release -eq 0 ]]; then
just clear-revapi
else
echo "💡 We don't clear RevAPI justifications on a pre-release"
fi
echo "✅ All set, don't forget to merge this branch and push upstream once Maven artifacts are available"
echo "💡 If you released from main:"
echo " git switch main"
echo " git merge release/${RELEASE_VERSION}"
echo " git merge ${RELEASE_BRANCH}"
echo " git push"
# Clear RevAPI justifications
Expand Down

0 comments on commit daa585c

Please sign in to comment.