Skip to content

Commit d8c82be

Browse files
committed
Add release instructions & build caches
1 parent f89b476 commit d8c82be

File tree

4 files changed

+57
-11
lines changed

4 files changed

+57
-11
lines changed

.github/workflows/merge.yml

+8
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,14 @@ jobs:
3232
server-username: ${{ secrets.OSSRH_USERNAME }}
3333
server-password: ${{ secrets.OSSRH_PASSWORD }}
3434

35+
- name: Cache local Maven repository
36+
uses: actions/cache@v2
37+
with:
38+
path: ~/.m2/repository
39+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
40+
restore-keys: |
41+
${{ runner.os }}-maven-
42+
3543
- name: Configure GPG Key
3644
run: |
3745
echo -n "$GPG_SIGNING_KEY" | base64 --decode | gpg --import

.github/workflows/pullrequest.yml

+9
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,15 @@ jobs:
1818
java-version: '8'
1919
distribution: 'temurin'
2020
cache: maven
21+
22+
- name: Cache local Maven repository
23+
uses: actions/cache@v2
24+
with:
25+
path: ~/.m2/repository
26+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
27+
restore-keys: |
28+
${{ runner.os }}-maven-
29+
2130
- name: Configure GPG Key
2231
run: |
2332
echo -n "$GPG_SIGNING_KEY" | base64 --decode | gpg --import

.github/workflows/release.yml

+31-11
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
# This workflow will build a package using Gradle and then publish it to GitHub packages when a release is created
66
# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#Publishing-using-gradle
77

8+
# maven deploy commands via via https://tech.clevertap.com/automate-releases-to-maven-central-via-github-actions/
9+
810
name: Release
911

1012
on:
@@ -26,16 +28,34 @@ jobs:
2628
with:
2729
java-version: '8'
2830
distribution: 'temurin'
29-
- name: Build with Gradle
30-
uses: gradle/gradle-build-action@0d13054264b0bb894ded474f08ebb30921341cee
31-
with:
32-
arguments: build
33-
# The USERNAME and TOKEN need to correspond to the credentials environment variables used in
34-
# the publishing section of your build.gradle
35-
- name: Publish to Sonatype (Maven)
36-
uses: gradle/gradle-build-action@0d13054264b0bb894ded474f08ebb30921341cee
31+
cache: maven
32+
server-id: ossrh
33+
server-username: ${{ secrets.OSSRH_USERNAME }}
34+
server-password: ${{ secrets.OSSRH_PASSWORD }}
35+
36+
- name: Configure GPG Key
37+
run: |
38+
echo -n "$GPG_SIGNING_KEY" | base64 --decode | gpg --import
39+
env:
40+
GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }}
41+
42+
- name: Build with Maven
43+
run: mvn --batch-mode --update-snapshots verify
44+
45+
- name: Upload coverage to Codecov
46+
uses: codecov/codecov-action@v2
3747
with:
38-
arguments: publish -PossrhUsername=${{ secrets.OSSRH_USERNAME }} -PossrhPassword=${{ secrets.OSSRH_PASSWORD }}
48+
directory: lib/build
49+
flags: unittests # optional
50+
name: coverage # optional
51+
fail_ci_if_error: true # optional (default = false)
52+
verbose: true # optional (default = false)
53+
- name: Deploy
54+
run: |
55+
mvn -P gpg_verify \
56+
--no-transfer-progress \
57+
--batch-mode \
58+
--file pom.xml -s release/m2-settings.xml verify deploy
3959
env:
40-
release: true
41-
REPOSITORY_URL: https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/
60+
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
61+
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}

release/m2-settings.xml

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<settings>
2+
<servers>
3+
<server>
4+
<id>ossrh</id>
5+
<username>${env.OSSRH_USERNAME}</username>
6+
<password>${env.OSSRH_PASSWORD}</password>
7+
</server>
8+
</servers>
9+
</settings>

0 commit comments

Comments
 (0)