Skip to content

Commit

Permalink
Update release process (#74)
Browse files Browse the repository at this point in the history
* add release checklist

* add deploy and release scripts
  • Loading branch information
sarahsnow1 authored May 4, 2017
1 parent c528ae1 commit e954785
Show file tree
Hide file tree
Showing 5 changed files with 108 additions and 1 deletion.
3 changes: 2 additions & 1 deletion circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ deployment:
master:
branch: master
commands:
- ./gradlew uploadArchives -PsonatypeUsername=$SONATYPE_NEXUS_SNAPSHOTS_USERNAME -PsonatypePassword=$SONATYPE_NEXUS_SNAPSHOTS_PASSWORD
- scripts/deploy-snapshot.sh
- scripts/release.sh
release:
tag: /pelias-android-sdk-[0-9]+(\.[0-9]+)*(-rc[0-9])?/
owner: pelias
Expand Down
44 changes: 44 additions & 0 deletions release_checklist.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Release Checklist

Instructions to build a new release version of **Pelias** and deploy to [Maven Central][3].

### 0. Build & Deploy Release

Ensure that you have set a CIRCLE_TOKEN environment variable.

Run the deploy script with the release and new version specified like so:
```bash
$ ./scripts/deploy.sh 1.1.0 1.1.2-SNAPSHOT
```

Verify snapshot build was successfully deployed to [Sonatype OSS Snapshots][1].

### 1. Promote Artifact on Maven Central

Login to [Sonatype OSS Staging][2] and find the newly created staging repository. Select the repository and click "Close". Enter a description and click "Confirm".

Example:

> Promote artifact pelias-android-sdk-1.1.0
### 2. Release Artifact to Maven Central

Login to [Sonatype OSS Staging][3] and find the promoted staging repository from step 2. Select the repository and click "Release". Enter a description and click "Confirm".

Example:

> Release artifact pelias-android-sdk-1.1.0
**Note: It may take up to two hours for new artifacts to appear in [Maven Central][3].**

For more information see the official [Sonatype OSS Maven Repository Usage Guide][4].

### 3. Update Documentation

Update the README download instructions to point to the newly released artifact. Add release notes and attach the artifact to the list of [releases][5].

[1]:https://oss.sonatype.org/#view-repositories;snapshots~browsestorage
[2]:https://oss.sonatype.org/#stagingRepositories
[3]:http://search.maven.org/
[4]:https://docs.sonatype.org/display/Repository/Sonatype+OSS+Maven+Repository+Usage+Guide
[5]:https://github.com/pelias/pelias-android-sdk/releases
13 changes: 13 additions & 0 deletions scripts/deploy-snapshot.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env bash
#
# Builds and uploads snapshot AARs to https://oss.sonatype.org/content/repositories/snapshots/com/mapzen/.
#

while read -r line || [[ -n "$line" ]]; do
if [[ $line =~ .*version=.*-SNAPSHOT.* ]]
then
./gradlew uploadArchives -PsonatypeUsername=$SONATYPE_NEXUS_SNAPSHOTS_USERNAME \
-PsonatypePassword=$SONATYPE_NEXUS_SNAPSHOTS_PASSWORD
break
fi
done < "gradle.properties"
34 changes: 34 additions & 0 deletions scripts/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/usr/bin/env bash
#
# triggers circle build with parameters to trigger a release
#

if [ -z ${CIRCLE_TOKEN} ]
then
echo "[ERROR] CIRCLE_TOKEN environment variable is not set."
exit 1
fi

if [ $# -ne 2 ]; then
echo "[ERROR] release and new version numbers not specified. Exiting."
exit 1
fi

trigger_build_url=https://circleci.com/api/v1/project/pelias/pelias-android-sdk/tree/master?circle-token=${CIRCLE_TOKEN}

post_data=$(cat <<EOF
{
"build_parameters": {
"RELEASE_VERSION_NUMBER": "$1",
"NEW_VERSION_NUMBER": "$2"
}
}
EOF)
curl \
--header "Accept: application/json" \
--header "Content-Type: application/json" \
--data "${post_data}" \
--request POST ${trigger_build_url}
echo
15 changes: 15 additions & 0 deletions scripts/release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash
#
# runs the gradle release plugin
#

if ([ -z $RELEASE_VERSION_NUMBER ] || [ -z $NEW_VERSION_NUMBER ]); then
echo "RELEASE_VERSION_NUMBER or NEW_VERSION_NUMBER not specified, skipping release."
else
echo "Releasing"
git config --global user.email "[email protected]"
git config --global user.name "Mapzen Developer"
./gradlew release -Prelease.useAutomaticVersion=true \
-Prelease.releaseVersion=$RELEASE_VERSION_NUMBER \
-Prelease.newVersion=$NEW_VERSION_NUMBER
fi

0 comments on commit e954785

Please sign in to comment.