-
Notifications
You must be signed in to change notification settings - Fork 260
/
release.sh
executable file
·31 lines (20 loc) · 1.12 KB
/
release.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env bash
set -euxo pipefail
: "${1?"Usage: $0 <[pre]major|[pre]minor|[pre]patch|prerelease>"}"
: "${CHANGELOG_GITHUB_TOKEN?"Needs CHANGELOG_GITHUB_TOKEN env var (access token with repo scopes)"}"
./mvnw scm:check-local-modification
[ "$1" == "prerelease" ] && versionsuffix="" || versionsuffix="-"
current=$({ echo 0.0.0; git -c "versionsort.suffix=${versionsuffix}" tag --list --sort=version:refname; } | tail -n1)
release=$(semver "${current}" -i "$1" --preid RC)
next=$(semver "${release}" -i minor)
./mvnw versions:set -D newVersion="${release}"
docker run -it --rm -e CHANGELOG_GITHUB_TOKEN -v "$(pwd)":/usr/local/src/your-app \
githubchangeloggenerator/github-changelog-generator \
-u zalando -p logbook \
--future-release ${release} \
--exclude-labels "duplicate,question,invalid,wontfix,stale,not-a-bug"
git commit -am "Release ${release}"
./mvnw clean deploy scm:tag -P release -D tag="${release}" -D pushChanges=false -D skipTests -D dependency-check.skip
./mvnw versions:set -D newVersion="${next}-SNAPSHOT"
git commit -am "Development ${next}-SNAPSHOT"
git push --atomic origin main "${release}"