Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remake build configuration to allow GH Package Registry deployment #32

Merged
merged 3 commits into from
Sep 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
# Enable access to bash-scripts
- chmod +x ./attempt-travis-deploy.sh
- chmod +x ./project-version.sh
- chmod +x ./.travis/ossrh-deploy.sh
- chmod +x ./.travis/deploy-to-maven-repositories.sh
- ./attempt-travis-deploy.sh

# Cached directories
Expand Down
26 changes: 26 additions & 0 deletions .travis/.mvn/github-package-registry-settings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">

<!-- Maven settings to be used on Maven build in TravisCI -->

<servers>
<server>
<id>github-package-registry</id>
<username>${env.GITHUB_PACKAGE_REGISTRY_DEPLOYER}</username>
<password>${env.GITHUB_PACKAGE_REGISTRY_TOKEN}</password>
</server>
</servers>

<profiles>
<profile>
<id>code-signing-credentials</id>
<properties>
<gpg.executable>gpg</gpg.executable>
<gpg.keyname>${env.GPG_KEY_NAME}</gpg.keyname>
<gpg.passphrase>${env.GPG_KEY_PASSPHRASE}</gpg.passphrase>
</properties>
</profile>
</profiles>
</settings>
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

<profiles>
<profile>
<id>ossrh-env-credentials</id>
<id>code-signing-credentials</id>
<properties>
<gpg.executable>gpg</gpg.executable>
<gpg.keyname>${env.GPG_KEY_NAME}</gpg.keyname>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,15 @@ echo 'Imported encryption key'

echo 'Deploying artifacts'
# Generate source and javadocs, sign binaries, deploy to Sonatype using credentials from env.
mvn deploy -P build-extras,sign,ossrh-env-credentials,ossrh-deploy --settings .travis/.mvn/settings.xml

echo 'Deploying to Sonatype OSSRH (also used for Central integration)'
mvn deploy -P build-extras,sign,code-signing-credentials,sonatype-ossrh-deploy \
--settings .travis/.mvn/sonatype-ossrh-settings.xml
echo 'Deployed to Sonatype OSSRH'

echo 'Deploying to GitHub Package Registry'
mvn deploy -P build-extras,sign,code-signing-credentials \
--settings .travis/.mvn/github-package-registry-settings.xml
echo 'Deployed to GiHub Package Registry'

echo 'Deployed artifacts'
4 changes: 2 additions & 2 deletions attempt-travis-deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ if [[ ${project_version} == *-SNAPSHOT ]]; then # Try to deploy snapshot if vers
# Snapshots deployment happens only for `development` branch excluding pull requests to it (but including merges)
if [[ "${TRAVIS_BRANCH}" = "${SNAPSHOTS_BRANCH}" ]]; then
echo "Deploying ${project_version} to Sonatype repository"
.travis/ossrh-deploy.sh
.travis/deploy-to-maven-repositories.sh
else
echo "Not deploying snapshot as branch is not ${SNAPSHOTS_BRANCH}"
fi
Expand All @@ -31,7 +31,7 @@ else # Try to deploy release if version doesn't end with '-SNAPSHOT'
# Release deployment happens only for `release` branch excluding pull requests to it (but including merges)
if [[ "${TRAVIS_BRANCH}" = "${RELEASES_BRANCH}" ]]; then
echo "Deploying ${project_version} to Maven Central"
.travis/ossrh-deploy.sh
.travis/deploy-to-maven-repositories.sh
else
echo "Not deploying release as branch is not \`${SNAPSHOTS_BRANCH}\`"
fi
Expand Down
37 changes: 25 additions & 12 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,6 @@
<developerConnection>scm:git:git@github.com:JarvisCraft/padla.git</developerConnection>
</scm>

<distributionManagement>
<repository>
<id>central</id>
<url>http://repo1.maven.org/maven2/</url>
</repository>
<snapshotRepository>
<id>ossrh</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
</distributionManagement>

<developers>
<developer>
<id>progrm-jarvis</id>
Expand Down Expand Up @@ -243,7 +232,7 @@
<profiles>
<!-- Maven-central deployment-related profiles -->
<profile>
<id>ossrh-deploy</id>
<id>sonatype-ossrh-deploy</id>
<build>
<plugins>
<plugin>
Expand Down Expand Up @@ -304,5 +293,29 @@
</plugins>
</build>
</profile>

<profile>
<id>sonatype-deployment</id>
<distributionManagement>
<repository>
<id>maven-central</id>
<url>http://repo1.maven.org/maven2/</url>
</repository>
<snapshotRepository>
<id>sonatype-ossrh</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
</distributionManagement>
</profile>

<profile>
<id>github-package-registry-deployment</id>
<distributionManagement>
<repository>
<id>github-package-registry</id>
<url>https://maven.pkg.github.com/JarvisCraft/padla</url>
</repository>
</distributionManagement>
</profile>
</profiles>
</project>