Skip to content

Commit

Permalink
Publish commit packages to Sonatype
Browse files Browse the repository at this point in the history
Discussion: https://lists.lfaidata.foundation/g/janusgraph-dev/topic/discussion_release_snapshot/84922650
Signed-off-by: Oleksandr Porunov <alexandr.porunov@gmail.com>
  • Loading branch information
porunov committed Dec 8, 2022
1 parent 4e49657 commit 7bc48de
Show file tree
Hide file tree
Showing 9 changed files with 168 additions and 54 deletions.
71 changes: 71 additions & 0 deletions .github/workflows/ci-publish-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# Copyright 2022 JanusGraph Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

name: CI Release commit artifacts publish to `org.janusgraph.commit` groupId

on:
push:
branches:
- master
- v*

jobs:
commit-publish:
runs-on: ubuntu-20.04
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '8.0.312+7'
java-package: jdk
- name: Remove version SNAPSHOT suffix if exists
run: mvn versions:set -DremoveSnapshot=true -DgenerateBackupPoms=false
- name: Set JanusGraph version environment variable
run: |
export JG_VER="$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)-$(date '+%Y%m%d-%H%M%S').$(git rev-parse --short HEAD)"
export JG_DESCRIPTION="Janusgraph commit release. Commit $(git rev-parse HEAD). Branch $(git rev-parse --abbrev-ref HEAD). Version $JG_VER."
echo "JG_VER=${JG_VER}" >> $GITHUB_ENV
echo "JG_DESCRIPTION=${JG_DESCRIPTION}" >> $GITHUB_ENV
- name: Configure GPG Key
run: |
echo -n "$GPG_SIGNING_KEY" | base64 --decode | gpg --import
env:
GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }}
- name: Set OSSR credentials
run: |
mkdir -p ~/.m2/
echo "<settingsSecurity><master>$MASTER_PASSWORD</master></settingsSecurity>" > ~/.m2/settings-security.xml
echo "<settings><servers><server><id>ossrh</id><username>$OSSRH_USERNAME</username><password>$OSSRH_PASSWORD</password></server></servers></settings>" > ~/.m2/settings.xml
env:
MASTER_PASSWORD: ${{ secrets.MASTER_PASSWORD }}
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
- name: Replace groupId to commit groupId
run: find ./ -type f -name "pom.xml" -exec sed -i "s/<groupId>org.janusgraph<\/groupId>/<groupId>org.janusgraph.commit<\/groupId>/g" {} \;
- name: Setup unique version
run: mvn versions:set -DnewVersion="$JG_VER" -DgenerateBackupPoms=false
- name: Make JanusGraph JAR artifacts
run: mvn clean install -Pjanusgraph-release -DskipTests=true
- name: Deploy JanusGraph JAR artifacts into staging repository
run: mvn deploy -Pjanusgraph-release,janusgraph-commit-release -DskipTests=true -DautoReleaseAfterClose=true -Ddescription="$JG_DESCRIPTION" -DstagingDescription="$JG_DESCRIPTION"
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

name: CI Release artifacts publish
name: CI Release artifacts publish to `org.janusgraph` groupId

on:
push:
Expand Down
75 changes: 75 additions & 0 deletions docs/advanced-topics/commit-releases.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# Snapshot releases

In addition to official JanusGraph releases, JanusGraph publishes
releases for each commit. The commit releases allow users to use latest
JanusGraph features without relying on official JanusGraph releases.
- Official JanusGraph releases are better tested and usually come with finalized
changes which signals that the used features are most likely to be stable for long term.
- Commit releases are not manually verified but instead verified by main CI tests as
well as scheduled full CI tests (once per week). New features in commit releases are not
guaranteed to be compatible between commits. Thus, you may expect more breaking changes between
commit releases and official releases.

## Maven repository artifacts

Both official and commit release are deployed to Sonatype OSS and are available in Sonatype Maven Central Repository
under different group ids.

Official JanusGraph releases have the next groupId: `org.janusgraph`.
Dependencies example:
```xml tab='Maven'
<dependency>
<groupId>org.janusgraph</groupId>
<artifactId>janusgraph-core</artifactId>
<version>0.6.2</version>
</dependency>
```

```groovy tab='Gradle'
compile "org.janusgraph:janusgraph-core:0.6.2"
```

Commit JanusGraph releases have the next groupId: `org.janusgraph.commit`.
Artifact id for commit releases have the next format: `FOLLOWING_VERSION-DATE-TIME.COMMIT`.
- `FOLLOWING_VERSION` is the upcoming official version to be used after release is finalized (i.e. `0.6.3` if the current latest release is `0.6.2`).
- `DATE` - date of the commit release in `yyyyMMdd` format.
- `TIME` - time of the commit release in `HHmmss` format.
- `COMMIT` - short commit hash of the commit used in the release.

Dependencies example:
```xml tab='Maven'
<dependency>
<groupId>org.janusgraph.commit</groupId>
<artifactId>janusgraph-core</artifactId>
<version>0.6.3-20221207-100250.39839b810</version>
</dependency>
```

```groovy tab='Gradle'
compile "org.janusgraph.commit:janusgraph-core:0.6.3-20221207-100250.39839b810"
```

## JanusGraph distribution builds

In addition to distribution builds provided for each official JanusGraph release, snapshot distribution builds are
provided for all commits.

!!! info
GitHub allows to download distribution builds only for authenticated GitHub users.

To access the distribution build bundle for any commit, please open the commit you are interested in and select its
`CI Release` details. For example:
![](github_release_ci.png)

When `CI Release` page is opened for a specific commit, open summary and download the attached to `Artifacts` section
file named `distribution-builds`. This will download `distribution-builds.zip` archive containing all distribution builds.
![](github_distribution_builds.png)

!!! warning
Old snapshot distribution builds are expiring in GitHub due to timing and memory limits. It's not guaranteed that
the snapshot distribution build downloaded yesterday is available today. We encourage to use either official release
distribution builds or newer snapshot distribution builds.

If you see expired distribution builds or don't see any distribution builds for a specific commit, it means that it isn't
available to be downloaded anymore. Thus, the distribution builds from newer commits should be used.
![](github_expired_distribution_builds.png)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/advanced-topics/github_release_ci.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
53 changes: 0 additions & 53 deletions docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,59 +156,6 @@ To build JanusGraph you need [git](http://git-scm.com/) and
Note, that running the comprehensive test suite requires a
significant amount of of time (&gt; 1 hour).

### Depending on JanusGraph Snapshots

For developing against the most current version of JanusGraph, depend on
JanusGraph snapshot releases. Note, that these releases are development
releases and therefore unstable and likely to change. Unless one is
interested in the most recent development status of JanusGraph, we
recommend to use the stable JanusGraph release instead.

=== "Maven"
```xml
<dependency>
<groupId>org.janusgraph</groupId>
<artifactId>janusgraph-core</artifactId>
<version>{{ snapshot_version }}</version>
</dependency>
```

=== "Gradle"
```groovy
compile "org.janusgraph:janusgraph-core:{{ snapshot_version }}"
```

Check the [master branch](https://github.com/JanusGraph/janusgraph/tree/master) for the
most current release version. SNAPSHOTs will be available through the
[Sonatype repository](https://oss.sonatype.org/content/repositories/snapshots/org/janusgraph/).

When adding this dependency, be sure to add the following repository to build file:

=== "Maven"
```xml
<repository>
<id>ossrh</id>
<name>Sonatype Nexus Snapshots</name>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
```

=== "Gradle"
```groovy
maven {
url "https://oss.sonatype.org/content/repositories/snapshots"
mavenContent {
snapshotsOnly()
}
}
```

### FAQs

**Maven build causes dozens of "\[WARNING\] We have a duplicate…"
Expand Down
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ nav:
- JanusGraph Bus: advanced-topics/janusgraph-bus.md
- ExecutorService: advanced-topics/executor-service.md
- Technical Limitations: advanced-topics/technical-limitations.md
- Snapshot Releases: advanced-topics/commit-releases.md
- Common Questions: common-questions.md
- Development: development.md
- Changelog: changelog.md
Expand Down
20 changes: 20 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1278,6 +1278,26 @@
</build>
</profile>

<profile>
<id>janusgraph-commit-release</id>
<build>
<plugins>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.13</version>
<extensions>true</extensions>
<configuration>
<!-- The Base URL of Nexus instance where we want to stage -->
<nexusUrl>https://oss.sonatype.org</nexusUrl>
<!-- The server "id" element from settings to use authentication from -->
<serverId>ossrh</serverId>
</configuration>
</plugin>
</plugins>
</build>
</profile>

<profile>
<id>hadoop2</id>

Expand Down

0 comments on commit 7bc48de

Please sign in to comment.