Skip to content

Commit 17f0a17

Browse files
runningcodeclaude
andcommitted
fix(ci): Use version for release tag instead of branch name
When the release workflow is triggered via workflow_dispatch, the release and tag were named after the branch (e.g., "master") instead of the actual version. Now the version is extracted from build.gradle.kts and used for both the tag and the GitHub release. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 47f3de5 commit 17f0a17

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

.github/workflows/gradle-release.yml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,15 @@ jobs:
1313
contents: write
1414
steps:
1515
- uses: actions/checkout@v6
16+
- name: Determine release version
17+
id: version
18+
run: |
19+
if [[ "${{ github.ref_type }}" == "tag" ]]; then
20+
echo "tag=${{ github.ref_name }}" >> "$GITHUB_OUTPUT"
21+
else
22+
version=$(grep '^version' fladle-plugin/build.gradle.kts | sed 's/version = "//;s/"//')
23+
echo "tag=v${version}" >> "$GITHUB_OUTPUT"
24+
fi
1625
- uses: actions/setup-java@v5
1726
with:
1827
java-version: "17"
@@ -34,7 +43,14 @@ jobs:
3443
ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.GPG_SIGNING_KEY_ID }}
3544
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.GPG_SIGNING_KEY_PASSWORD }}
3645
run: ./gradlew :fladle-plugin:publishPlugins
46+
- name: Create tag if needed
47+
run: |
48+
tag="${{ steps.version.outputs.tag }}"
49+
if ! git rev-parse "$tag" >/dev/null 2>&1; then
50+
git tag "$tag"
51+
git push origin "$tag"
52+
fi
3753
- name: Create GitHub Release
3854
env:
3955
GH_TOKEN: ${{ github.token }}
40-
run: gh release create "${{ github.ref_name }}" --generate-notes
56+
run: gh release create "${{ steps.version.outputs.tag }}" --generate-notes

0 commit comments

Comments
 (0)