Skip to content

Commit e88e562

Browse files
gopalldbclaudevikrantpuppalaCopilot
authored
Fix release workflow to update sequence for thin release (databricks#1096)
## Description <!-- Provide a brief summary of the changes made and the issue they aim to address.--> Thin will be released after main, so that it gets benefit of all tests and validations and same will not be run for thin again. ## Testing <!-- Describe how the changes have been tested--> ## Additional Notes to the Reviewer <!-- Share any additional context or insights that may help the reviewer understand the changes better. This could include challenges faced, limitations, or compromises made during the development process. Also, mention any areas of the code that you would like the reviewer to focus on specifically. --> NO_CHANGELOG=true --------- Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: Vikrant Puppala <vikrantpuppala@gmail.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent fc020e7 commit e88e562

File tree

2 files changed

+50
-11
lines changed

2 files changed

+50
-11
lines changed

.github/workflows/release-thin.yml

Lines changed: 47 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,33 @@
11
name: Release Thin JAR
22
on:
3-
push:
4-
tags:
5-
- 'v*'
3+
workflow_run:
4+
workflows: ["Release"]
5+
types:
6+
- completed
67
workflow_dispatch:
8+
inputs:
9+
tag:
10+
description: 'Tag to release (e.g., v3.0.5)'
11+
required: true
12+
type: string
713

814
jobs:
915
publish-thin:
16+
# Only run if main JAR workflow succeeded or manual trigger
17+
if: |
18+
github.event_name == 'workflow_dispatch' ||
19+
(github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success')
1020
runs-on:
1121
group: databricks-protected-runner-group
1222
labels: linux-ubuntu-latest
1323
steps:
1424
- name: Checkout
1525
uses: actions/checkout@v4
26+
with:
27+
# If manual trigger: use input tag, else use the SHA from the completed workflow run
28+
ref: ${{ github.event_name == 'workflow_dispatch' && format('refs/tags/{0}', inputs.tag) || github.event.workflow_run.head_sha }}
29+
fetch-tags: true
30+
fetch-depth: 0
1631

1732
- name: Set up Java for publishing to Maven Central Repository
1833
uses: actions/setup-java@v4
@@ -126,9 +141,38 @@ jobs:
126141
MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
127142
MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
128143

144+
- name: Get tag name from commit
145+
id: get_tag
146+
run: |
147+
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
148+
# For manual trigger, use the input tag directly
149+
TAG="${{ inputs.tag }}"
150+
else
151+
# For workflow_run, find the tag pointing to the current commit
152+
TAG=$(git tag --points-at HEAD | grep "^v" | head -1)
153+
if [ -z "$TAG" ]; then
154+
echo "Error: No tag found for current commit"
155+
exit 1
156+
fi
157+
fi
158+
echo "tag=$TAG" >> $GITHUB_OUTPUT
159+
echo "Found tag: $TAG"
160+
161+
- name: Verify main release exists
162+
if: github.event_name == 'workflow_run'
163+
run: |
164+
echo "Verifying main release exists for ${{ steps.get_tag.outputs.tag }}"
165+
gh release view "${{ steps.get_tag.outputs.tag }}" || {
166+
echo "Error: Main release not found for tag ${{ steps.get_tag.outputs.tag }}"
167+
exit 1
168+
}
169+
env:
170+
GH_TOKEN: ${{ github.token }}
171+
129172
- name: Upload Thin JAR to GitHub Release
130173
uses: softprops/action-gh-release@v1
131174
with:
175+
tag_name: ${{ steps.get_tag.outputs.tag }}
132176
files: |
133177
target/*-thin.jar
134178

.github/workflows/release.yml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
11
name: Release
22
on:
3+
push:
4+
tags:
5+
- 'v*'
36
workflow_dispatch:
4-
workflow_run:
5-
workflows: ["Release Thin JAR"]
6-
types:
7-
- completed
87

98
jobs:
109
publish:
11-
# Only run if thin JAR workflow succeeded or manual trigger
12-
if: |
13-
github.event_name == 'workflow_dispatch' ||
14-
(github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success')
1510
runs-on:
1611
group: databricks-protected-runner-group
1712
labels: linux-ubuntu-latest

0 commit comments

Comments
 (0)