Skip to content

Commit 608a011

Browse files
committed
ci: allow publish workflow dispatch from branches
1 parent 1e5f1ee commit 608a011

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

.github/workflows/publish.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,21 @@ jobs:
2525

2626
- name: Verify tag matches package version
2727
run: |
28-
TAG_VERSION="${GITHUB_REF_NAME#v}"
2928
PACKAGE_VERSION="$(python - <<'PY'
3029
import tomllib
3130
with open("pyproject.toml", "rb") as f:
3231
data = tomllib.load(f)
3332
print(data["project"]["version"])
3433
PY
3534
)"
36-
if [ "$TAG_VERSION" != "$PACKAGE_VERSION" ]; then
37-
echo "Tag version ($TAG_VERSION) does not match package version ($PACKAGE_VERSION)."
38-
exit 1
35+
if [ "${GITHUB_REF_TYPE}" = "tag" ]; then
36+
TAG_VERSION="${GITHUB_REF_NAME#v}"
37+
if [ "$TAG_VERSION" != "$PACKAGE_VERSION" ]; then
38+
echo "Tag version ($TAG_VERSION) does not match package version ($PACKAGE_VERSION)."
39+
exit 1
40+
fi
41+
else
42+
echo "Non-tag ref '${GITHUB_REF_NAME}', publishing package version ${PACKAGE_VERSION}."
3943
fi
4044

4145
- name: Build distributions

0 commit comments

Comments
 (0)