11name : zarr-metadata release
22
3- # Manual-only release for now. Once we settle on a tag scheme
4- # (e.g. `zarr-metadata/v0.1.0`), this workflow can grow a
5- # `release:` or `push: tags:` trigger.
6- #
7- # Operator picks the target index at dispatch time:
8- # - `pypi` -> https://pypi.org
9- # - `testpypi` -> https://test.pypi.org
10- #
11- # Both indexes reject re-uploads of an existing version, so each publish
12- # requires a version bump in pyproject.toml. For TestPyPI dry-runs, use a
13- # PEP 440 pre-release/dev suffix (e.g. `0.1.0.dev1`) in the source.
143on :
154 workflow_dispatch :
16- inputs :
17- target :
18- description : ' Index to publish to'
19- required : true
20- type : choice
21- default : testpypi
22- options :
23- - testpypi
24- - pypi
5+ release :
6+ types : [published]
257
268permissions :
279 contents : read
2810
2911concurrency :
30- group : ${{ github.workflow }}-${{ github.ref }}-${{ inputs.target }}
12+ group : ${{ github.workflow }}-${{ github.ref }}
3113 cancel-in-progress : false
3214
3315jobs :
4224 - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
4325 with :
4426 persist-credentials : false
27+ fetch-depth : 0 # hatch-vcs needs full history + tags
4528
4629 - name : Install Hatch
4730 uses : pypa/hatch@257e27e51a6a5616ed08a39a408a21c35c9931bc
6649 name : zarr-metadata-dist
6750 path : dist
6851
69- - name : List built artifacts
70- run : ls -la dist
71-
7252 - name : Install uv
7353 uses : astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
7454
@@ -79,12 +59,12 @@ jobs:
7959 run : |
8060 wheel=$(ls dist/*.whl)
8161 uv run --with "${wheel}" --python 3.12 --no-project \
82- python -c "import zarr_metadata; print('zarr_metadata', zarr_metadata.__version__) "
62+ python -c "import zarr_metadata"
8363
8464 upload_pypi :
8565 name : Upload to PyPI
8666 needs : [build, test_artifacts]
87- if : inputs.target == 'pypi'
67+ if : github.event_name == 'release' && startsWith(github.event.release.tag_name, 'zarr_metadata/')
8868 runs-on : ubuntu-latest
8969 environment :
9070 name : zarr-metadata-releases
10989 upload_testpypi :
11090 name : Upload to TestPyPI
11191 needs : [build, test_artifacts]
112- if : inputs.target == 'testpypi '
92+ if : github.event_name == 'workflow_dispatch '
11393 runs-on : ubuntu-latest
11494 environment :
11595 name : zarr-metadata-releases-test
0 commit comments