Skip to content

Commit 46843be

Browse files
d-v-bmaxrjones
andauthored
Removes testpypi as a target for the workflow-dispatch-triggered release workflow. (#3822)
* Removes testpypi as a target for the workflow-dispatch-triggered release workflow. Zarr Python is not configured for OIDC on TestPyPI, and there was a bug in the previous workflow that prevented command line declaration of the PyPI target (real or test) from being evaluated correctly. To simplify this, TestPyPI is removed, and only RealPyPI can be the target for publishing. * update --------- Co-authored-by: Max Jones <14077947+maxrjones@users.noreply.github.com>
1 parent 9fa1016 commit 46843be

File tree

1 file changed

+21
-14
lines changed

1 file changed

+21
-14
lines changed

.github/workflows/releases.yml

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,6 @@ on:
1111
description: 'Git tag to build and publish (e.g. v3.1.6)'
1212
required: true
1313
type: string
14-
test_pypi:
15-
description: 'Publish to Test PyPI instead of PyPI'
16-
required: false
17-
type: boolean
18-
default: true
1914

2015
permissions:
2116
contents: read
@@ -26,7 +21,26 @@ concurrency:
2621

2722
jobs:
2823

24+
validate_tag:
25+
if: github.event_name == 'workflow_dispatch'
26+
runs-on: ubuntu-latest
27+
steps:
28+
- name: Validate tag format
29+
run: |
30+
if [[ ! "${{ inputs.tag }}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+([a-z]+[0-9]*)?$ ]]; then
31+
echo "::error::Invalid tag format '${{ inputs.tag }}'. Expected format: v1.2.3, v1.2.3a1, v1.2.3rc1"
32+
exit 1
33+
fi
34+
- name: Verify tag exists
35+
run: |
36+
git ls-remote --tags "${{ github.server_url }}/${{ github.repository }}" "${{ inputs.tag }}" | grep -q "${{ inputs.tag }}" || {
37+
echo "::error::Tag '${{ inputs.tag }}' does not exist in the repository"
38+
exit 1
39+
}
40+
2941
build_artifacts:
42+
needs: [validate_tag]
43+
if: always() && (needs.validate_tag.result == 'success' || needs.validate_tag.result == 'skipped')
3044
name: Build wheel on ubuntu-latest
3145
runs-on: ubuntu-latest
3246
strategy:
@@ -74,10 +88,10 @@ jobs:
7488
runs-on: ubuntu-latest
7589
if: >-
7690
(github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v'))
77-
|| github.event_name == 'workflow_dispatch'
91+
|| (github.event_name == 'workflow_dispatch' && startsWith(inputs.tag, 'v'))
7892
environment:
7993
name: releases
80-
url: ${{ (github.event_name == 'workflow_dispatch' && inputs.test_pypi) && 'https://test.pypi.org/p/zarr' || 'https://pypi.org/p/zarr' }}
94+
url: https://pypi.org/p/zarr
8195
permissions:
8296
id-token: write
8397
attestations: write
@@ -93,10 +107,3 @@ jobs:
93107
subject-path: dist/*
94108
- name: Publish package to PyPI
95109
uses: pypa/gh-action-pypi-publish@v1.13.0
96-
if: ${{ !(github.event_name == 'workflow_dispatch' && inputs.test_pypi) }}
97-
98-
- name: Publish package to Test PyPI
99-
uses: pypa/gh-action-pypi-publish@v1.13.0
100-
if: ${{ github.event_name == 'workflow_dispatch' && inputs.test_pypi }}
101-
with:
102-
repository-url: https://test.pypi.org/legacy/

0 commit comments

Comments
 (0)