Skip to content

Commit 6197f98

Browse files
fix: resolve detached HEAD push failure in v1 public release
Add target-branch input to shared workflow so the post-release pom.xml commit is pushed to the correct branch (v1 for 1.x.x tags, main for others) instead of failing with 'not on a branch' error. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
1 parent 66ce7f6 commit 6197f98

4 files changed

Lines changed: 30 additions & 3 deletions

File tree

.github/workflows/internal-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
- "pom.xml"
66
- "*.md"
77
branches:
8-
- release/*
8+
- release/**
99

1010
jobs:
1111
build-and-deploy:

.github/workflows/release-v1.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Publish v1 package to the Maven Central Repository
2+
on:
3+
push:
4+
tags:
5+
- '1.*.*'
6+
jobs:
7+
build-and-deploy:
8+
uses: ./.github/workflows/shared-build-and-deploy.yml
9+
with:
10+
ref: ${{ github.ref_name }}
11+
is-internal: false
12+
target-branch: v1
13+
server-id: ossrh
14+
profile: maven-central
15+
secrets:
16+
server-username: ${{ secrets.OSSRH_USERNAME }}
17+
server-password: ${{ secrets.OSSRH_PASSWORD }}
18+
gpg-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
19+
gpg-passphrase: ${{ secrets.MAVEN_GPG_PASSPHRASE }}

.github/workflows/release.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
name: Publish package to the Maven Central Repository
22
on:
33
push:
4-
tags: '*.*.*'
4+
tags:
5+
- '[2-9]*.*.*'
56
jobs:
67
build-and-deploy:
78
uses: ./.github/workflows/shared-build-and-deploy.yml
89
with:
910
ref: ${{ github.ref_name }}
1011
is-internal: false
12+
target-branch: main
1113
server-id: ossrh
1214
profile: maven-central
1315
secrets:

.github/workflows/shared-build-and-deploy.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ on:
77
required: true
88
type: string
99

10+
target-branch:
11+
description: 'Branch to push the version bump commit back to'
12+
required: false
13+
type: string
14+
default: 'main'
15+
1016
is-internal:
1117
description: 'Flag for internal release'
1218
required: true
@@ -79,7 +85,7 @@ jobs:
7985
git push origin ${{ github.ref_name }} -f
8086
else
8187
git commit -m "[AUTOMATED] Public Release - ${{ steps.previoustag.outputs.tag }}"
82-
git push origin
88+
git push origin HEAD:${{ inputs.target-branch }}
8389
fi
8490
8591
- name: Create env

0 commit comments

Comments
 (0)