Skip to content

Commit e80a117

Browse files
committed
chore(ci): checkout latest release tag on manual dispatch
1 parent e258afa commit e80a117

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

.github/workflows/publish.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,22 @@ jobs:
2020
steps:
2121
- name: Checkout
2222
uses: actions/checkout@v4
23+
with:
24+
fetch-depth: 0
25+
fetch-tags: true
26+
27+
# On manual dispatch, jump to the latest `codetime@*` tag so we always
28+
# publish the most recent release rather than whatever is on the branch.
29+
- name: Checkout latest tag (manual dispatch)
30+
if: github.event_name == 'workflow_dispatch'
31+
run: |
32+
latest_tag=$(git tag --list 'codetime@*' --sort=-v:refname | head -n 1)
33+
if [ -z "$latest_tag" ]; then
34+
echo "no codetime@* tag found" >&2
35+
exit 1
36+
fi
37+
echo "checking out $latest_tag"
38+
git checkout "refs/tags/$latest_tag"
2339
2440
- name: Setup pnpm
2541
uses: pnpm/action-setup@v4

0 commit comments

Comments
 (0)