Skip to content

Commit 748dc71

Browse files
authored
Add customizable tag_prefix input to publish workflow (#293)
Signed-off-by: Matthieu MOREL <[email protected]>
1 parent ed9c189 commit 748dc71

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

.github/workflows/publish.yaml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,13 @@ on:
106106
Email of the git committer. Defaults to the GitHub Action bot's email.
107107
default: "41898282+github-actions[bot]@users.noreply.github.com"
108108
type: string
109+
tag_prefix:
110+
description: |
111+
The prefix to remove from the tag name to calculate the version.
112+
For example, with prefix 'v' and tag 'v1.2.3', the version becomes '1.2.3'.
113+
With prefix 'bazel-v' and tag 'bazel-v1.2.3', the version becomes '1.2.3'.
114+
default: "v"
115+
type: string
109116
secrets:
110117
publish_token:
111118
required: true
@@ -135,12 +142,13 @@ jobs:
135142
path: bazel-central-registry
136143
persist-credentials: false
137144

138-
# Get version from the tag, stripping any v-prefix
145+
# Get version from the tag, stripping the specified prefix
139146
- name: Write release version
140147
env:
141148
TAG: ${{ inputs.tag_name }}
149+
PREFIX: ${{ inputs.tag_prefix }}
142150
run: |
143-
VERSION=${TAG#v}
151+
VERSION=${TAG#$PREFIX}
144152
echo Version: $VERSION
145153
echo "VERSION=$VERSION" >> $GITHUB_ENV
146154

0 commit comments

Comments
 (0)