Skip to content

Commit 21007cf

Browse files
committed
Make automatic release artifacts publishing
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 <alexandr.porunov@gmail.com>
1 parent 72a1d96 commit 21007cf

3 files changed

Lines changed: 725 additions & 68 deletions

File tree

.github/workflows/ci-publish.yml

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
# Copyright 2022 JanusGraph Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
name: CI Release artifacts publish
16+
17+
on:
18+
push:
19+
tags:
20+
- v*.*.*
21+
22+
jobs:
23+
build-all:
24+
runs-on: ubuntu-20.04
25+
steps:
26+
- uses: actions/checkout@v2
27+
- uses: actions/setup-java@v2
28+
with:
29+
distribution: 'zulu'
30+
java-version: '8.0.312+7'
31+
java-package: jdk
32+
- name: Set up Python
33+
uses: actions/setup-python@v2
34+
with:
35+
python-version: 3.8
36+
architecture: x64
37+
- name: Install pip3
38+
run: sudo apt-get update && sudo apt-get install -y python3-pip
39+
- name: Set JanusGraph versions environment variables
40+
run: |
41+
export RELEASE_TAG=${{github.ref_name}}
42+
export JG_VER="${RELEASE_TAG//v/}"
43+
export JG_DIST_NAME="janusgraph-${JG_VER}"
44+
export JG_FULL_DIST_NAME="janusgraph-full-${JG_VER}"
45+
export JG_DOC_DIST_NAME="${JG_DIST_NAME}-doc"
46+
echo "RELEASE_TAG=${RELEASE_TAG}" >> $GITHUB_ENV
47+
echo "JG_VER=${JG_VER}" >> $GITHUB_ENV
48+
echo "JG_DIST_NAME=${JG_DIST_NAME}" >> $GITHUB_ENV
49+
echo "JG_FULL_DIST_NAME=${JG_FULL_DIST_NAME}" >> $GITHUB_ENV
50+
echo "JG_DOC_DIST_NAME=${JG_DOC_DIST_NAME}" >> $GITHUB_ENV
51+
- name: Configure GPG Key
52+
run: |
53+
echo -n "$GPG_SIGNING_KEY" | base64 --decode | gpg --import
54+
env:
55+
GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }}
56+
- name: Set OSSR credentials
57+
run: |
58+
mkdir -p ~/.m2/
59+
echo "<settingsSecurity><master>$MASTER_PASSWORD</master></settingsSecurity>" > ~/.m2/settings-security.xml
60+
echo "<settings><servers><server><id>ossrh</id><username>$OSSRH_USERNAME</username><password>$OSSRH_PASSWORD</password></server></servers></settings>" > ~/.m2/settings.xml
61+
env:
62+
MASTER_PASSWORD: ${{ secrets.MASTER_PASSWORD }}
63+
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
64+
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
65+
# TODO: the step "Make JanusGraph JAR artifacts" should also create signature key for full JanusGraph bundle but for some
66+
# reason it doesn't sign full distribution (only standard distribution).
67+
# After this is fixed we can delete the step "Sign JanusGraph full distribution artifact".
68+
- name: Make JanusGraph JAR artifacts
69+
run: mvn clean install -Pjanusgraph-release -DskipTests=true
70+
- name: Print content of the generated target directory for debugging purposes
71+
run: echo $(ls janusgraph-dist/target/)
72+
- name: Deploy JanusGraph JAR artifacts into staging repository
73+
run: mvn deploy -Pjanusgraph-release -DskipTests=true
74+
- name: Sign JanusGraph full distribution artifact
75+
run: gpg --armor --detach-sign --yes janusgraph-dist/target/${JG_FULL_DIST_NAME}.zip
76+
- name: Install requirements to build documentation
77+
run: pip3 install -r requirements.txt
78+
- name: Build documentation
79+
run: mkdocs build
80+
- name: Pack documentation into zip
81+
run: |
82+
mv site ${JG_DOC_DIST_NAME}
83+
zip -r ${JG_DOC_DIST_NAME}.zip ${JG_DOC_DIST_NAME}
84+
- name: Sign documentation artifact
85+
run: gpg --armor --detach-sign ${JG_DOC_DIST_NAME}.zip
86+
- name: Check distribution signature
87+
run: gpg --verify janusgraph-dist/target/${JG_DIST_NAME}.zip.asc janusgraph-dist/target/${JG_DIST_NAME}.zip
88+
- name: Check full distribution signature
89+
run: gpg --verify janusgraph-dist/target/${JG_FULL_DIST_NAME}.zip.asc janusgraph-dist/target/${JG_FULL_DIST_NAME}.zip
90+
- name: Check documentation signature
91+
run: gpg --verify ${JG_DOC_DIST_NAME}.zip.asc ${JG_DOC_DIST_NAME}.zip
92+
- uses: ncipollo/release-action@v1
93+
with:
94+
allowUpdates: true
95+
artifactErrorsFailBuild: true
96+
draft: true
97+
tag: "${{ env.RELEASE_TAG }}"
98+
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"
99+
name: "${{ env.JG_VER }}"
100+
omitBodyDuringUpdate: true
101+
omitNameDuringUpdate: true
102+
omitPrereleaseDuringUpdate: true
103+
owner: janusgraph-bot
104+
prerelease: true
105+
replacesArtifacts: true
106+
token: ${{ secrets.GITHUB_TOKEN }}
107+
body: |
108+
# Version ${{ env.JG_VER }} (MM DD, YYYY)
109+
![Number of release downloads](https://img.shields.io/github/downloads/JanusGraph/janusgraph/${{ env.RELEASE_TAG }}/total.svg)
110+
111+
Full documentation can be found at https://docs.janusgraph.org/
112+
113+
```xml
114+
<dependency>
115+
<groupId>org.janusgraph</groupId>
116+
<artifactId>janusgraph-core</artifactId>
117+
<version>${{ env.JG_VER }}</version>
118+
</dependency>
119+
```
120+
121+
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).

0 commit comments

Comments
 (0)