Skip to content

Commit af18f32

Browse files
committed
Update release.yml
1 parent 2fd0cdb commit af18f32

1 file changed

Lines changed: 63 additions & 4 deletions

File tree

.github/workflows/release.yml

Lines changed: 63 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,25 @@ jobs:
4747
version: ${{ steps.version.outputs.version }}
4848

4949
steps:
50+
- name: Resolve checkout ref
51+
id: resolve-ref
52+
run: |
53+
COMMIT_ID="${{ github.event.inputs.commit_id }}"
54+
BRANCH="${{ github.event.inputs.branch }}"
55+
# Strip vcs.revision= prefix if accidentally included
56+
COMMIT_ID="${COMMIT_ID#vcs.revision=}"
57+
if [ -n "$COMMIT_ID" ]; then
58+
echo "ref=$COMMIT_ID" >> $GITHUB_OUTPUT
59+
elif [ -n "$BRANCH" ]; then
60+
echo "ref=$BRANCH" >> $GITHUB_OUTPUT
61+
else
62+
echo "ref=" >> $GITHUB_OUTPUT
63+
fi
64+
5065
- name: Checkout code
5166
uses: actions/checkout@v4
5267
with:
53-
ref: ${{ github.event.inputs.commit_id || github.event.inputs.branch || '' }}
68+
ref: ${{ steps.resolve-ref.outputs.ref || '' }}
5469
fetch-depth: 0
5570

5671
- name: Get version
@@ -83,6 +98,8 @@ jobs:
8398
8499
VERSION=${{ steps.version.outputs.version }}
85100
COMMIT_REF="${{ github.event.inputs.commit_id }}"
101+
# Strip vcs.revision= prefix if accidentally included
102+
COMMIT_REF="${COMMIT_REF#vcs.revision=}"
86103
if [ -z "$COMMIT_REF" ]; then
87104
COMMIT_REF="HEAD"
88105
fi
@@ -140,10 +157,24 @@ jobs:
140157
needs: build-linux # Wait for version tag to be created
141158

142159
steps:
160+
- name: Resolve checkout ref
161+
id: resolve-ref
162+
run: |
163+
COMMIT_ID="${{ github.event.inputs.commit_id }}"
164+
BRANCH="${{ github.event.inputs.branch }}"
165+
COMMIT_ID="${COMMIT_ID#vcs.revision=}"
166+
if [ -n "$COMMIT_ID" ]; then
167+
echo "ref=$COMMIT_ID" >> $GITHUB_OUTPUT
168+
elif [ -n "$BRANCH" ]; then
169+
echo "ref=$BRANCH" >> $GITHUB_OUTPUT
170+
else
171+
echo "ref=" >> $GITHUB_OUTPUT
172+
fi
173+
143174
- name: Checkout code
144175
uses: actions/checkout@v4
145176
with:
146-
ref: ${{ github.event.inputs.commit_id || github.event.inputs.branch || '' }}
177+
ref: ${{ steps.resolve-ref.outputs.ref || '' }}
147178
fetch-depth: 0
148179

149180
- name: Get version
@@ -213,10 +244,24 @@ jobs:
213244
needs: build-linux # Wait for version tag to be created
214245

215246
steps:
247+
- name: Resolve checkout ref
248+
id: resolve-ref
249+
run: |
250+
COMMIT_ID="${{ github.event.inputs.commit_id }}"
251+
BRANCH="${{ github.event.inputs.branch }}"
252+
COMMIT_ID="${COMMIT_ID#vcs.revision=}"
253+
if [ -n "$COMMIT_ID" ]; then
254+
echo "ref=$COMMIT_ID" >> $GITHUB_OUTPUT
255+
elif [ -n "$BRANCH" ]; then
256+
echo "ref=$BRANCH" >> $GITHUB_OUTPUT
257+
else
258+
echo "ref=" >> $GITHUB_OUTPUT
259+
fi
260+
216261
- name: Checkout code
217262
uses: actions/checkout@v4
218263
with:
219-
ref: ${{ github.event.inputs.commit_id || github.event.inputs.branch || '' }}
264+
ref: ${{ steps.resolve-ref.outputs.ref || '' }}
220265
fetch-depth: 0
221266

222267
- name: Get version
@@ -411,10 +456,24 @@ jobs:
411456
needs: [build-linux, build-linux-arm64, build-macos]
412457

413458
steps:
459+
- name: Resolve checkout ref
460+
id: resolve-ref
461+
run: |
462+
COMMIT_ID="${{ github.event.inputs.commit_id }}"
463+
BRANCH="${{ github.event.inputs.branch }}"
464+
COMMIT_ID="${COMMIT_ID#vcs.revision=}"
465+
if [ -n "$COMMIT_ID" ]; then
466+
echo "ref=$COMMIT_ID" >> $GITHUB_OUTPUT
467+
elif [ -n "$BRANCH" ]; then
468+
echo "ref=$BRANCH" >> $GITHUB_OUTPUT
469+
else
470+
echo "ref=" >> $GITHUB_OUTPUT
471+
fi
472+
414473
- name: Checkout code
415474
uses: actions/checkout@v4
416475
with:
417-
ref: ${{ github.event.inputs.commit_id || github.event.inputs.branch || '' }}
476+
ref: ${{ steps.resolve-ref.outputs.ref || '' }}
418477
fetch-depth: 0
419478

420479
- name: Get version

0 commit comments

Comments
 (0)