| 1 |
name: Build Java Release |
| 2 |
on: |
| 3 |
push: |
| 4 |
tags: |
| 5 |
# if you change this pattern, make sure jobs.strip-tag still works |
| 6 |
- 'release/java/v[0-9]+.[0-9]+.[0-9]+' |
| 7 |
|
| 8 |
permissions: {} |
| 9 |
|
| 10 |
jobs: |
| 11 |
ci: |
| 12 |
permissions: |
| 13 |
contents: read |
| 14 |
uses: ./.github/workflows/java-build.yml |
| 15 |
|
| 16 |
strip-tag: |
| 17 |
name: Compute version from tag |
| 18 |
runs-on: ubuntu-latest |
| 19 |
outputs: |
| 20 |
version: ${{ steps.version.outputs.version }} |
| 21 |
steps: |
| 22 |
- name: process tag |
| 23 |
id: version |
| 24 |
env: |
| 25 |
TAG: ${{ github.ref_name }} |
| 26 |
run: | |
| 27 |
echo "version=${TAG#"release/java/v"}" >> $GITHUB_OUTPUT |
| 28 |
|
| 29 |
build: |
| 30 |
name: Build, Sign, and Release Java artifacts |
| 31 |
runs-on: ubuntu-latest |
| 32 |
needs: [ci, strip-tag] |
| 33 |
permissions: |
| 34 |
contents: read # to checkout code |
| 35 |
id-token: write # to sign with sigstore |
| 36 |
steps: |
| 37 |
- name: checkout tag |
| 38 |
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 39 |
with: |
| 40 |
persist-credentials: false |
| 41 |
|
| 42 |
- name: Set up JDK 25 |
| 43 |
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0 |
| 44 |
with: |
| 45 |
java-version: 25 |
| 46 |
distribution: 'temurin' |
| 47 |
|
| 48 |
- name: Authenticate to Google Cloud |
| 49 |
uses: google-github-actions/auth@7c6bc770dae815cd3e89ee6cdf493a5fab2cc093 # v3.0.0 |
| 50 |
with: |
| 51 |
workload_identity_provider: projects/306323169285/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions-provider |
| 52 |
service_account: [email protected] |
| 53 |
|
| 54 |
- uses: google-github-actions/get-secretmanager-secrets@bc9c54b29fdffb8a47776820a7d26e77b379d262 # v3.0.0 |
| 55 |
id: secrets |
| 56 |
with: |
| 57 |
secrets: |- |
| 58 |
signing_key:sigstore-secrets/sigstore-java-pgp-priv-key |
| 59 |
signing_password:sigstore-secrets/sigstore-java-pgp-priv-key-password |
| 60 |
sonatype_username:sigstore-secrets/sigstore-sonatype-central-portal-username |
| 61 |
sonatype_password:sigstore-secrets/sigstore-sonatype-central-portal-password |
| 62 |
|
| 63 |
- name: Build, Sign and Push to Maven Central |
| 64 |
# TODO: someone still needs to close and release this, but that can be automated next |
| 65 |
working-directory: ./java |
| 66 |
env: |
| 67 |
VERSION: ${{ needs.strip-tag.outputs.version }} |
| 68 |
ORG_GRADLE_PROJECT_signingKey: ${{ steps.secrets.outputs.signing_key }} |
| 69 |
ORG_GRADLE_PROJECT_signingPassword: ${{ steps.secrets.outputs.signing_password }} |
| 70 |
CENTRAL_PORTAL_USERNAME: ${{ steps.secrets.outputs.sonatype_username }} |
| 71 |
CENTRAL_PORTAL_PASSWORD: ${{ steps.secrets.outputs.sonatype_password }} |
| 72 |
run: | |
| 73 |
./gradlew clean :publishAggregationToCentralPortal -Pversion=${VERSION} -Prelease |