Skip to content

Commit

Permalink
Make automatic release artifacts publishing
Browse files Browse the repository at this point in the history
Automatically build and publish jar artifacts to Sonatype staging repository;
Automatically create release and upload all necessary artifacts into the release artifacts in GitHub;
Automatically update release artifacts if tag was re-uploaded (i.e. to make changes into the release we need to delete tag and push it again to GitHub targeting the necessary commit);

Signed-off-by: Oleksandr Porunov <[email protected]>
  • Loading branch information
porunov committed Jan 18, 2022
1 parent 72a1d96 commit 21007cf
Show file tree
Hide file tree
Showing 3 changed files with 725 additions and 68 deletions.
121 changes: 121 additions & 0 deletions .github/workflows/ci-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
# 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 artifacts publish

on:
push:
tags:
- v*.*.*

jobs:
build-all:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: '8.0.312+7'
java-package: jdk
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
architecture: x64
- name: Install pip3
run: sudo apt-get update && sudo apt-get install -y python3-pip
- name: Set JanusGraph versions environment variables
run: |
export RELEASE_TAG=${{github.ref_name}}
export JG_VER="${RELEASE_TAG//v/}"
export JG_DIST_NAME="janusgraph-${JG_VER}"
export JG_FULL_DIST_NAME="janusgraph-full-${JG_VER}"
export JG_DOC_DIST_NAME="${JG_DIST_NAME}-doc"
echo "RELEASE_TAG=${RELEASE_TAG}" >> $GITHUB_ENV
echo "JG_VER=${JG_VER}" >> $GITHUB_ENV
echo "JG_DIST_NAME=${JG_DIST_NAME}" >> $GITHUB_ENV
echo "JG_FULL_DIST_NAME=${JG_FULL_DIST_NAME}" >> $GITHUB_ENV
echo "JG_DOC_DIST_NAME=${JG_DOC_DIST_NAME}" >> $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 }}
# TODO: the step "Make JanusGraph JAR artifacts" should also create signature key for full JanusGraph bundle but for some
# reason it doesn't sign full distribution (only standard distribution).
# After this is fixed we can delete the step "Sign JanusGraph full distribution artifact".
- name: Make JanusGraph JAR artifacts
run: mvn clean install -Pjanusgraph-release -DskipTests=true
- name: Print content of the generated target directory for debugging purposes
run: echo $(ls janusgraph-dist/target/)
- name: Deploy JanusGraph JAR artifacts into staging repository
run: mvn deploy -Pjanusgraph-release -DskipTests=true
- name: Sign JanusGraph full distribution artifact
run: gpg --armor --detach-sign --yes janusgraph-dist/target/${JG_FULL_DIST_NAME}.zip
- name: Install requirements to build documentation
run: pip3 install -r requirements.txt
- name: Build documentation
run: mkdocs build
- name: Pack documentation into zip
run: |
mv site ${JG_DOC_DIST_NAME}
zip -r ${JG_DOC_DIST_NAME}.zip ${JG_DOC_DIST_NAME}
- name: Sign documentation artifact
run: gpg --armor --detach-sign ${JG_DOC_DIST_NAME}.zip
- name: Check distribution signature
run: gpg --verify janusgraph-dist/target/${JG_DIST_NAME}.zip.asc janusgraph-dist/target/${JG_DIST_NAME}.zip
- name: Check full distribution signature
run: gpg --verify janusgraph-dist/target/${JG_FULL_DIST_NAME}.zip.asc janusgraph-dist/target/${JG_FULL_DIST_NAME}.zip
- name: Check documentation signature
run: gpg --verify ${JG_DOC_DIST_NAME}.zip.asc ${JG_DOC_DIST_NAME}.zip
- uses: ncipollo/release-action@v1
with:
allowUpdates: true
artifactErrorsFailBuild: true
draft: true
tag: "${{ env.RELEASE_TAG }}"
artifacts: "KEYS,${{ env.JG_DOC_DIST_NAME }}.zip.asc,${{ env.JG_DOC_DIST_NAME }}.zip,janusgraph-dist/target/${{ env.JG_DIST_NAME }}.zip.asc,janusgraph-dist/target/${{ env.JG_DIST_NAME }}.zip,janusgraph-dist/target/${{ env.JG_FULL_DIST_NAME }}.zip.asc,janusgraph-dist/target/${{ env.JG_FULL_DIST_NAME }}.zip"
name: "${{ env.JG_VER }}"
omitBodyDuringUpdate: true
omitNameDuringUpdate: true
omitPrereleaseDuringUpdate: true
owner: janusgraph-bot
prerelease: true
replacesArtifacts: true
token: ${{ secrets.GITHUB_TOKEN }}
body: |
# Version ${{ env.JG_VER }} (MM DD, YYYY)
![Number of release downloads](https://img.shields.io/github/downloads/JanusGraph/janusgraph/${{ env.RELEASE_TAG }}/total.svg)
Full documentation can be found at https://docs.janusgraph.org/
```xml
<dependency>
<groupId>org.janusgraph</groupId>
<artifactId>janusgraph-core</artifactId>
<version>${{ env.JG_VER }}</version>
</dependency>
```
For more information on features and bug fixes in ${{env.JG_VER}}, see [this GitHub milestone](https://github.com/JanusGraph/janusgraph/milestone/*MILESTONE_NUMBER*?closed=1).
Loading

0 comments on commit 21007cf

Please sign in to comment.