forked from open-feature/java-sdk-contrib
-
Notifications
You must be signed in to change notification settings - Fork 0
64 lines (58 loc) · 2.74 KB
/
release-please.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
on:
push:
branches:
- main
name: Run Release Please
jobs:
release-please:
runs-on: ubuntu-latest
# Release-please creates a PR that tracks all changes
steps:
- uses: google-github-actions/release-please-action@e4dc86ba9405554aeba3c6bb2d169500e7d3b4ee # v4
id: release
with:
token: ${{secrets.GITHUB_TOKEN}}
# The logic below handles the maven publication:
- name: Checkout Repository
if: ${{ steps.release.outputs.releases_created }}
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4
- name: Set up JDK 8
if: ${{ steps.release.outputs.releases_created }}
uses: actions/setup-java@b36c23c0d998641eff861008f374ee103c25ac73 # v4
with:
java-version: '8'
distribution: 'temurin'
cache: maven
server-id: ossrh
server-username: OSSRH_USERNAME
server-password: OSSRH_PASSWORD
- name: Cache local Maven repository
if: ${{ steps.release.outputs.releases_created }}
uses: actions/cache@3624ceb22c1c5a301c8db4169662070a689d9ea8 # v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Configure GPG Key
if: ${{ steps.release.outputs.releases_created }}
run: |
echo -n "$GPG_SIGNING_KEY" | base64 --decode | gpg --import
env:
GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }}
# Release Please has already incremented versions and published tags, so we just need to publish (skip tests).
- name: Maven Verify Deploy -DskipTests
if: ${{ steps.release.outputs.releases_created }}
# The nexus-staging-maven-plugin doesn't follow maven conventions. It stages all the projects with the last submodule: https://help.sonatype.com/repomanager2/staging-releases/configuring-your-project-for-deployment
# This means there's no way to skip publishing of a particular module in a multi-module build, so we iterate over each module and publish them individually,
# letting exists-maven-plugin skip the nexus-staging-maven-plugin's entire deploy goal if the artifact exists.
run: |
mvn --non-recursive --batch-mode --settings release/m2-settings.xml -DskipTests clean deploy
modules=($(cat pom.xml | grep "<module>" | sed 's/\s*<.*>\(.*\)<.*>/\1/'))
for module in "${modules[@]}"
do
mvn --batch-mode --projects $module --settings release/m2-settings.xml -DskipTests clean deploy
done
env:
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}