Skip to content

Commit cb1a642

Browse files
committed
allow specifying tag
1 parent 0ac0011 commit cb1a642

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

.github/workflows/release.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
on:
22
workflow_dispatch:
3-
branches: [main]
3+
inputs:
4+
tag:
5+
description: "Tag to release (e.g. v1.7.0)"
6+
required: true
7+
type: string
48
push:
59
tags:
610
- "v*" # Push events to matching v*, i.e. v1.0, v20.15.10
@@ -26,6 +30,7 @@ jobs:
2630
steps:
2731
- uses: actions/checkout@v6
2832
with:
33+
ref: ${{ inputs.tag || github.ref }}
2934
fetch-depth: 0
3035
- uses: actions/setup-python@v6
3136
with:
@@ -39,7 +44,10 @@ jobs:
3944
echo "PROJECT_VERSION=$PROJECT_VERSION" >> $GITHUB_ENV
4045
- name: Check if tag version matches project version
4146
run: |
42-
TAG=$(git describe HEAD --tags --abbrev=0)
47+
TAG=${{ inputs.tag || '' }}
48+
if [[ -z "$TAG" ]]; then
49+
TAG=$(git describe HEAD --tags --abbrev=0)
50+
fi
4351
echo $TAG
4452
echo $PROJECT_VERSION
4553
if [[ "$TAG" != "v$PROJECT_VERSION" ]]; then exit 1; fi
@@ -55,7 +63,8 @@ jobs:
5563
env:
5664
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5765
with:
58-
name: Release ${{ github.ref }}
66+
tag_name: ${{ inputs.tag || github.ref_name }}
67+
name: Release ${{ inputs.tag || github.ref_name }}
5968
draft: true
6069
generate_release_notes: true
6170
files: |

0 commit comments

Comments
 (0)