Skip to content

Commit

Permalink
Update the deployment process to now use Maven Central
Browse files Browse the repository at this point in the history
  • Loading branch information
Henri Tremblay authored and Henri Tremblay committed Mar 22, 2021
1 parent 3c9cb54 commit b61c45b
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 60 deletions.
38 changes: 9 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ This build will create the source and javadoc jars and run spotbugs.
- Install the Android SDK (`brew cask install android-sdk`)
- Install `platform-tools` and `build-tools` using the sdkmanager (`sdkmanager "platform-tools" "build-tools"`)
- Add an `ANDROID_HOME` to target the Android SDK (`export ANDROID_HOME=$(realpath $(echo "$(dirname $(readlink $(which sdkmanager)))/../.."))`)
- Configure a device (real or simulated) and launch it
- Configure a device (real or simulated) and launch it (use API 26, after that it asks for a signature, that isn't supported yet)
- Activate the debug mode if it's a real device
- `mvn package -Pandroid`

Expand All @@ -70,21 +70,14 @@ cd benchmark
- You will first need to add something like this to your settings.xml
```xml
<servers>
<server>
<id>sonatype-nexus-snapshots</id>
<username>sonatypeuser</username>
<password>sonatypepassword</password>
</server>
<server>
<id>sonatype-nexus-staging</id>
<username>sonatypeuser</username>
<password>sonatypepassword</password>
</server>
<server>
<id>ossrh</id>
<username>sonatypeuser</username>
<password>sonatypepassword</password>
</server>
</servers>
```
- Then follow the instructions from the site below to create your key to sign the deployed items

http://www.sonatype.com/people/2010/01/how-to-generate-pgp-signatures-with-maven/
- Then follow the [instructions](https://central.sonatype.org/pages/working-with-pgp-signatures.html) from the site below to create your key to sign the deployed items

## To check dependencies and plugins versions

Expand Down Expand Up @@ -113,21 +106,6 @@ curl -s "https://api.github.com/repos/easymock/objenesis/issues?milestone=${mile
echo "</ul>"
```

* Add these servers to your `settings.xml`

```xml
<server>
<id>bintray</id>
<username>your-user-name</username>
<password>your-api-key</password>
</server>
<server>
<id>gpg.passphrase</id>
<passphrase>your-passphrase</passphrase>
</server>
```

* Set `gpg_passphrase`, `bintray_api_key` and `bintray_user` environment variables
* Launch an Android device (virtual or physical)
* Launch `./deploy.sh version`
* Answer the questions (normally, just acknowledge the proposed default)
Expand All @@ -141,6 +119,8 @@ git push origin :refs/tags/$version
git reset --hard HEAD~2
```

If you find something went wrong you can drop the staging repository with `mvn nexus-staging:drop`.

## Deploy the website

* Make sure the pom is at the version you want to release
Expand Down
31 changes: 4 additions & 27 deletions deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

# This script expects:
# - the version to be deployed as the first parameter
# - bintray_user to be an environment variable
# - bintray_api_key to be an environment variable

# to exit in case of error
set -e
Expand All @@ -27,11 +25,6 @@ if [ "$(git branch | grep ${version})" == "${version}" ]; then
exit 1
fi

message="should be an environment variable"
[ -z "$gpg_passphrase" ] && echo "gpg_passphrase $message" && exit 1
[ -z "$bintray_api_key" ] && echo "bintray_api_key $message" && exit 1
[ -z "$bintray_user" ] && echo "bintray_user $message" && exit 1

# Weird fix required by GPG. See https://github.com/keybase/keybase-issues/issues/1712. You will have to enter the passphrase on screen
export GPG_TTY=$(tty)

Expand All @@ -47,32 +40,16 @@ echo "Please add the release notes in github"
open "https://github.com/easymock/objenesis/tags"
pause

# Create the distribution in bintray
date=$(date "+%Y-%m-%d")
content="{ \"name\": \"$version\", \"desc\": \"$version\", \"released\": \"${date}T00:00:00.000Z\", \"github_use_tag_release_notes\": true, \"vcs_tag\": \"$version\" }"
curl -XPOST -H "Content-Type: application/json" -u${bintray_user}:${bintray_api_key} \
-d "$content" https://api.bintray.com/packages/easymock/distributions/objenesis/versions

curl -v -H "X-GPG-PASSPHRASE: $gpg_passphrase" -u${bintray_user}:${bintray_api_key} -T "main/target/objenesis-${version}-bin.zip" https://api.bintray.com/content/easymock/distributions/objenesis/${version}/objenesis-${version}-bin.zip?publish=1
curl -v -H "X-GPG-PASSPHRASE: $gpg_passphrase" -u${bintray_user}:${bintray_api_key} -T "tck/target/objenesis-tck-${version}.jar" https://api.bintray.com/content/easymock/distributions/objenesis/${version}/objenesis-tck-${version}.jar?publish=1
curl -v -H "X-GPG-PASSPHRASE: $gpg_passphrase" -u${bintray_user}:${bintray_api_key} -T "tck-android/target/objenesis-tck-android-${version}.apk" https://api.bintray.com/content/easymock/distributions/objenesis/${version}/objenesis-tck-android-${version}.apk?publish=1

echo "Flag the bin, tck and tck-android as 'Show in download list' in bintray"
open "https://bintray.com/easymock/distributions/objenesis/${version}#files"
pause

echo "Add the bin, tck and tck-android jars to the release in GitHub"
open "https://bintray.com/easymock/distributions/objenesis#"
# Release the jars now on central staging
echo "Check everything is alright, next step will release to central"
open "https://oss.sonatype.org/#welcome"
pause
mvn nexus-staging:release

echo "Close the milestone in GitHub and create the new one"
open "https://github.com/easymock/objenesis/milestones"
pause

echo "Sync to Maven central"
open "https://bintray.com/easymock/maven/objenesis/${version}#central"
pause

echo
echo "Job done!"
echo
22 changes: 18 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,17 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.8</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org</nexusUrl>
<autoReleaseAfterClose>false</autoReleaseAfterClose>
</configuration>
</plugin>
</plugins>
<extensions>
<extension>
Expand Down Expand Up @@ -427,10 +438,13 @@

<distributionManagement>
<repository>
<id>bintray</id>
<name>JFrog Bintray</name>
<url>https://api.bintray.com/maven/easymock/maven/objenesis/;publish=1</url>
<id>ossrh</id>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
<snapshotRepository>
<id>ossrh</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
</distributionManagement>

<profiles>
Expand All @@ -445,7 +459,7 @@
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
Expand Down

0 comments on commit b61c45b

Please sign in to comment.