Skip to content

Commit 148ef5e

Browse files
fix(ci): explicitly trigger Maven release workflow from release-please
GITHUB_TOKEN-triggered events don't cascade to prevent recursive workflows. When release-please creates a release using GITHUB_TOKEN, the 'release: published' event is suppressed and won't trigger the Maven Central publish workflow. Solution: explicitly trigger release.yml via workflow_dispatch when a release is created. Ref: https://docs.github.com/en/actions/security-for-github-actions/security-guides/automatic-token-authentication#using-the-github_token-in-a-workflow
1 parent a5399bb commit 148ef5e

1 file changed

Lines changed: 26 additions & 1 deletion

File tree

.github/workflows/release-please.yml

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,43 @@ on:
88
permissions:
99
contents: write
1010
pull-requests: write
11+
actions: write
1112

1213
jobs:
1314
release-please:
1415
runs-on: ubuntu-latest
16+
outputs:
17+
release_created: ${{ steps.release.outputs.release_created }}
18+
tag_name: ${{ steps.release.outputs.tag_name }}
1519
steps:
1620
- uses: actions/checkout@v4
1721
with:
1822
fetch-depth: 0
19-
23+
2024
- uses: googleapis/release-please-action@v4
2125
id: release
2226
with:
2327
config-file: release-please-config.json
2428
manifest-file: .release-please-manifest.json
2529
token: ${{ secrets.GITHUB_TOKEN }}
30+
31+
trigger-maven-release:
32+
needs: release-please
33+
if: ${{ needs.release-please.outputs.release_created == 'true' }}
34+
runs-on: ubuntu-latest
35+
steps:
36+
- name: Trigger Maven Central publish
37+
uses: actions/github-script@v7
38+
with:
39+
github-token: ${{ secrets.GITHUB_TOKEN }}
40+
script: |
41+
await github.rest.actions.createWorkflowDispatch({
42+
owner: context.repo.owner,
43+
repo: context.repo.repo,
44+
workflow_id: 'release.yml',
45+
ref: 'main',
46+
inputs: {
47+
tag_name: '${{ needs.release-please.outputs.tag_name }}'
48+
}
49+
});
50+
console.log('Triggered Maven Central publish workflow for tag: ${{ needs.release-please.outputs.tag_name }}');

0 commit comments

Comments
 (0)