Skip to content

Commit

Permalink
Update release script to follow the new versioning scheme (#85)
Browse files Browse the repository at this point in the history
  • Loading branch information
kawamuray authored Jan 25, 2021
1 parent fe2f796 commit 21dea3f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 35 deletions.
10 changes: 2 additions & 8 deletions developer-docs/making-release.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,10 @@ sonatypeUsername=// OSS Sonatype username that you created at step 1
sonatypePassword=// OSS Sonatype password that you created at step 1
```

## Releasing SNAPSHOT version

Run `./scripts/publish.sh`.

NOTE: It takes some moment (~1h) until the published version becomes visible to users.

## Releasing release version
## Releasing a new version

1. Check `:base_version:` of every documents under `./docs` to see if there's any article referring SNAPSHOT version. If any, strip SNAPSHOT suffix with carefully checking if the document is up-to-date with the version you're going to release. Then make a single commit to bump the document version and push it directly to the master branch.
2. Run `./script/publish.sh --release`.
2. Run `./script/publish.sh $RELEASE_VERSION`.
3. Upon successful exit, login to https://oss.sonatype.org and click "Staging Repositories" in the left panel. ![staging-repo](staging-repositories.png)
4. Confirm you see an entry for decaton in staging repositories list. Check the box and press the "Close" button. ![staging-list](staging-list.png)
5. It will take some time to complete. Keep polling the screen until the "Release" button becomes clickable. ![release-ready](./release-ready.png)
Expand Down
46 changes: 19 additions & 27 deletions scripts/publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@

# A script to publish maven artifacts of Decaton.
#
# Usage: ./publish.sh [--release]
# * --relese: publish new version of artifacts to Maven Central
# * otherwise: publish (or overwrite if exists) current SNAPSHOT version without changing version
# Usage: ./publish.sh $RELEASE_VERSION
#
set -eu

cd $(dirname $0)/..
Expand Down Expand Up @@ -47,17 +46,16 @@ validate_git_status() {

# Bump version in gradle.properties and create a tag
bump_version() {
version=$1
new_version=$(echo $version | awk -F '.' '{print $1"."$2"."$3+1}')
new_version=$1

sed -i "" -e "s/^version=$version/version=$new_version/" gradle.properties
sed -i "" -e "s/^version=.*$/version=$new_version/" gradle.properties

git add gradle.properties
git commit -m "Release $version"
git commit -m "Release $new_version"

git push origin master

tag="v$version"
tag="v$new_version"
git tag $tag
git push origin $tag
}
Expand All @@ -68,25 +66,19 @@ bump_version() {

validate_git_status

is_snapshot=true
if [[ $@ == *--release* ]]; then
is_snapshot=false
fi

# Extract version to be released
version=$(grep "^version=" gradle.properties | cut -f 2 -d=)

if [ $is_snapshot = true ]; then
echo "Publishing Decaton $version-SNAPSHOT"
./gradlew clean build publish
else
# prevent double publishing
if [ $(git tag | grep "^v$version\$" | wc -l) -ne 0 ]; then
echo "$version already released"
exit 1
fi
version="$1"
if [ -z "$version" ]; then
echo "Usage: $0 RELEASE_VERSION" >&2
exit 1
fi

echo "Publishing Decaton $version"
./gradlew -P snapshot=false clean build validateDocs publish
bump_version $version
# prevent double publishing
if [ $(git tag | grep "^v$version\$" | wc -l) -ne 0 ]; then
echo "$version already released"
exit 1
fi

echo "Publishing Decaton $version"
./gradlew -P snapshot=false -P version="$version" clean build validateDocs publish
bump_version $version

0 comments on commit 21dea3f

Please sign in to comment.