Skip to content

Commit 8c17177

Browse files
authored
fix(ci): trigger release-tag workflow via workflow_dispatch from auto-tag (#315)
1 parent 9d6d149 commit 8c17177

2 files changed

Lines changed: 33 additions & 7 deletions

File tree

.github/workflows/release-auto-tag.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,11 @@ jobs:
5050
run: |
5151
git tag ${{ steps.version.outputs.next }}
5252
git push origin ${{ steps.version.outputs.next }}
53+
54+
- name: Trigger Release Tag workflow
55+
env:
56+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
57+
run: |
58+
gh workflow run release-tag.yml \
59+
--ref main \
60+
-f tag=${{ steps.version.outputs.next }}

.github/workflows/release-tag.yml

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,22 @@ on:
44
push:
55
tags:
66
- "v*.*.*"
7+
workflow_dispatch:
8+
inputs:
9+
tag:
10+
description: "Git tag to release (e.g. v0.0.4)"
11+
required: true
12+
type: string
713

814
permissions:
915
contents: write
1016
packages: write
1117

18+
# Resolve the tag once: prefer the workflow_dispatch input, fall back to the
19+
# push-event ref. Every job references this via env.RELEASE_TAG.
20+
env:
21+
RELEASE_TAG: ${{ inputs.tag || github.ref_name }}
22+
1223
defaults:
1324
run:
1425
shell: bash
@@ -35,6 +46,7 @@ jobs:
3546
steps:
3647
- uses: actions/checkout@v4
3748
with:
49+
ref: ${{ inputs.tag || github.ref }}
3850
fetch-depth: 0
3951

4052
- name: Mark workspace safe for git
@@ -49,7 +61,7 @@ jobs:
4961
set -euo pipefail
5062
echo "python=$(uv run python tasks/scripts/release.py get-version --python)" >> "$GITHUB_OUTPUT"
5163
echo "cargo=$(uv run python tasks/scripts/release.py get-version --cargo)" >> "$GITHUB_OUTPUT"
52-
echo "semver=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"
64+
echo "semver=${RELEASE_TAG#v}" >> "$GITHUB_OUTPUT"
5365
5466
- name: Find previous release tag
5567
id: prev
@@ -59,7 +71,7 @@ jobs:
5971
# stable releases (no pre-release suffixes like -rc1), skip the current tag
6072
PREV=$(git tag --list 'v*.*.*' --sort=-version:refname \
6173
| grep -P '^v\d+\.\d+\.\d+$' \
62-
| grep -v "^${GITHUB_REF_NAME}$" \
74+
| grep -v "^${RELEASE_TAG}$" \
6375
| head -n1 || true)
6476
echo "tag=${PREV}" >> "$GITHUB_OUTPUT"
6577
echo "Previous release tag: ${PREV:-"(none, first release)"}"
@@ -131,6 +143,7 @@ jobs:
131143
steps:
132144
- uses: actions/checkout@v4
133145
with:
146+
ref: ${{ inputs.tag || github.ref }}
134147
fetch-depth: 0
135148

136149
- name: Log in to GHCR
@@ -186,6 +199,7 @@ jobs:
186199
steps:
187200
- uses: actions/checkout@v4
188201
with:
202+
ref: ${{ inputs.tag || github.ref }}
189203
fetch-depth: 0
190204

191205
- uses: actions/setup-python@v5
@@ -272,6 +286,7 @@ jobs:
272286
steps:
273287
- uses: actions/checkout@v4
274288
with:
289+
ref: ${{ inputs.tag || github.ref }}
275290
fetch-depth: 0
276291

277292
- name: Mark workspace safe for git
@@ -358,6 +373,7 @@ jobs:
358373
steps:
359374
- uses: actions/checkout@v4
360375
with:
376+
ref: ${{ inputs.tag || github.ref }}
361377
fetch-depth: 0
362378

363379
- name: Mark workspace safe for git
@@ -409,6 +425,8 @@ jobs:
409425
timeout-minutes: 10
410426
steps:
411427
- uses: actions/checkout@v4
428+
with:
429+
ref: ${{ inputs.tag || github.ref }}
412430

413431
- name: Download all CLI artifacts
414432
uses: actions/download-artifact@v4
@@ -433,14 +451,14 @@ jobs:
433451
- name: Create GitHub Release
434452
uses: softprops/action-gh-release@v2
435453
with:
436-
name: OpenShell ${{ github.ref_name }}
454+
name: OpenShell ${{ env.RELEASE_TAG }}
437455
prerelease: false
438-
tag_name: ${{ github.ref_name }}
456+
tag_name: ${{ env.RELEASE_TAG }}
439457
generate_release_notes: false
440458
body: |
441-
## OpenShell ${{ github.ref_name }}
459+
## OpenShell ${{ env.RELEASE_TAG }}
442460
443-
${{ needs.compute-versions.outputs.previous_tag != '' && format('**Full changelog**: [{0}...{1}](https://github.com/{2}/compare/{0}...{1})', needs.compute-versions.outputs.previous_tag, github.ref_name, github.repository) || '' }}
461+
${{ needs.compute-versions.outputs.previous_tag != '' && format('**Full changelog**: [{0}...{1}](https://github.com/{2}/compare/{0}...{1})', needs.compute-versions.outputs.previous_tag, env.RELEASE_TAG, github.repository) || '' }}
444462
445463
### Quick install
446464
@@ -454,7 +472,7 @@ jobs:
454472
Darwin-arm64) ASSET="openshell-aarch64-apple-darwin.tar.gz" ;; \
455473
*) echo "Unsupported platform: ${OS}-${ARCH}" >&2; exit 1 ;; \
456474
esac; \
457-
gh release download ${{ github.ref_name }} --repo NVIDIA/OpenShell --pattern "${ASSET}" -O - \
475+
gh release download ${{ env.RELEASE_TAG }} --repo NVIDIA/OpenShell --pattern "${ASSET}" -O - \
458476
| tar xz \
459477
&& sudo install -m 755 openshell /usr/local/bin/openshell'
460478
```

0 commit comments

Comments
 (0)