|
5 | 5 | name: Run Release Please
|
6 | 6 | jobs:
|
7 | 7 | release-please:
|
8 |
| - environment: publish |
9 | 8 | runs-on: ubuntu-latest
|
| 9 | + permissions: |
| 10 | + contents: write # for googleapis/release-please-action to create release commit |
| 11 | + pull-requests: write # for googleapis/release-please-action to create release PR |
| 12 | + issues: write # for googleapis/release-please-action to create labels |
10 | 13 |
|
11 | 14 | # Release-please creates a PR that tracks all changes
|
12 | 15 | steps:
|
13 | 16 | - uses: googleapis/release-please-action@v4
|
14 | 17 | id: release
|
15 | 18 | with:
|
16 | 19 | token: ${{secrets.RELEASE_PLEASE_ACTION_TOKEN}}
|
| 20 | + outputs: |
| 21 | + release_created: ${{ steps.release.outputs.release_created }} |
| 22 | + release_tag_name: ${{ steps.release.outputs.tag_name }} |
17 | 23 |
|
| 24 | + publish: |
| 25 | + environment: publish |
| 26 | + runs-on: ubuntu-latest |
| 27 | + permissions: |
| 28 | + contents: read |
| 29 | + needs: release-please |
| 30 | + if: ${{ fromJSON(needs.release-please.outputs.release_created || false) }} |
| 31 | + |
| 32 | + steps: |
18 | 33 | # The logic below handles the maven publication:
|
19 | 34 | - name: Checkout Repository
|
20 |
| - if: ${{ steps.release.outputs.releases_created }} |
21 | 35 | uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
|
22 | 36 |
|
23 | 37 | - name: Set up JDK 21
|
24 |
| - if: ${{ steps.release.outputs.releases_created }} |
25 | 38 | uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4
|
26 | 39 | with:
|
27 | 40 | java-version: '21'
|
|
32 | 45 | server-password: OSSRH_PASSWORD
|
33 | 46 |
|
34 | 47 | - name: Cache local Maven repository
|
35 |
| - if: ${{ steps.release.outputs.releases_created }} |
36 | 48 | uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4
|
37 | 49 | with:
|
38 | 50 | path: ~/.m2/repository
|
|
49 | 61 |
|
50 | 62 | # Release Please has already incremented versions and published tags, so we just need to publish (skip tests).
|
51 | 63 | - name: Maven Verify Deploy -DskipTests
|
52 |
| - if: ${{ steps.release.outputs.releases_created }} |
53 | 64 | # 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
|
54 | 65 | # 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,
|
55 | 66 | # letting exists-maven-plugin skip the nexus-staging-maven-plugin's entire deploy goal if the artifact exists.
|
|
0 commit comments