Skip to content

Commit 39e296d

Browse files
committed
feat: add tagName input and checkout refs to checksum workflows
- Add tagName input parameter to source-checksums-reusable.yml and asset-checksums-reusable.yml - Update tag resolution logic to prioritize tagName over other inputs - Add checkout steps with proper ref handling for both workflows - Ensure consistent behavior when called from release workflow with specific tags
1 parent 7f29f3c commit 39e296d

File tree

3 files changed

+37
-11
lines changed

3 files changed

+37
-11
lines changed

.github/workflows/asset-checksums-reusable.yml

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,15 @@
44
name: Create and publish checksums of release assets
55
on:
66
workflow_call:
7-
workflow_dispatch:
87
inputs:
8+
tagName:
9+
description: The tag name of release to publish for
10+
type: string
11+
required: false
912
semver:
10-
description: The semver of the release to publish for
13+
description: The semver of release to publish for
1114
type: string
12-
required: true
15+
required: false
1316

1417
permissions:
1518
contents: write
@@ -24,10 +27,14 @@ jobs:
2427
- name: 🏷️
2528
id: tag
2629
run: |
27-
if [ -n "${{ github.event.release.name }}" ]; then
30+
if [ -n "${{ inputs.tagName }}" ]; then
31+
echo "tag=${{ inputs.tagName }}" >> $GITHUB_OUTPUT
32+
elif [ -n "${{ github.event.release.name }}" ]; then
2833
echo "tag=${{ github.event.release.tag_name }}" >> $GITHUB_OUTPUT
29-
else
34+
elif [ -n "${{ github.event.inputs.semver }}" ]; then
3035
echo "tag=mdns-browser-v${{ github.event.inputs.semver }}" >> $GITHUB_OUTPUT
36+
else
37+
echo "No tag provided" && exit 1
3138
fi
3239
3340
generate_checksums:
@@ -39,6 +46,12 @@ jobs:
3946
matrix:
4047
algorithm: [sha256]
4148
steps:
49+
- name: 🔄 Checkout
50+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
51+
with:
52+
ref: ${{ needs.tag.outputs.tag }}
53+
fetch-depth: 1
54+
4255
- name: 📥 assets
4356
uses: robinraju/release-downloader@daf26c55d821e836577a15f77d86ddc078948b05 # v1.12
4457
with:

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ jobs:
157157
uses: ./.github/workflows/source-checksums-reusable.yml
158158
secrets: inherit
159159
with:
160-
semver: ${{ github.event_name == 'release' && github.event.release.tag_name || needs.version_management.outputs.version }}
160+
tagName: ${{ github.event_name == 'release' && github.event.release.tag_name || format('mdns-browser-v{0}', needs.version_management.outputs.version) }}
161161

162162
build_artifacts:
163163
needs: [version_management, create_prerelease, source_checksums]

.github/workflows/source-checksums-reusable.yml

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,15 @@
44
name: Create and publish source checksum
55
on:
66
workflow_call:
7-
workflow_dispatch:
87
inputs:
8+
tagName:
9+
description: The tag name of release to publish for
10+
type: string
11+
required: false
912
semver:
10-
description: The semver of the release to publish for
13+
description: The semver of release to publish for
1114
type: string
12-
required: true
15+
required: false
1316

1417
permissions:
1518
contents: write
@@ -24,10 +27,14 @@ jobs:
2427
- name: 🏷️
2528
id: tag
2629
run: |
27-
if [ -n "${{ github.event.release.name }}" ]; then
30+
if [ -n "${{ inputs.tagName }}" ]; then
31+
echo "tag=${{ inputs.tagName }}" >> $GITHUB_OUTPUT
32+
elif [ -n "${{ github.event.release.name }}" ]; then
2833
echo "tag=${{ github.event.release.tag_name }}" >> $GITHUB_OUTPUT
29-
else
34+
elif [ -n "${{ github.event.inputs.semver }}" ]; then
3035
echo "tag=mdns-browser-v${{ github.event.inputs.semver }}" >> $GITHUB_OUTPUT
36+
else
37+
echo "No tag provided" && exit 1
3138
fi
3239
3340
generate_checksums:
@@ -39,6 +46,12 @@ jobs:
3946
matrix:
4047
algorithm: [sha256]
4148
steps:
49+
- name: 🔄 Checkout
50+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
51+
with:
52+
ref: ${{ needs.tag.outputs.tag }}
53+
fetch-depth: 1
54+
4255
- name: 📥🔢☑️
4356
run: |
4457
set -o errexit

0 commit comments

Comments
 (0)