@@ -216,6 +216,7 @@ jobs:
216216 name : release
217217 url : https://pypi.org/project/bioimageio.spec/
218218 permissions :
219+ contents : write # required for tag creation
219220 id-token : write # required for pypi publish action
220221 steps :
221222 - name : Check out the repository
@@ -228,26 +229,19 @@ jobs:
228229 echo "sha=$(git rev-parse --verify --quiet HEAD^)" >> $GITHUB_OUTPUT
229230
230231 - name : Detect new version
231- id : check -version
232+ id : tag -version
232233 if : github.ref == 'refs/heads/main' && steps.check-parent-commit.outputs.sha
233234234235 with :
235- create-tag : false
236+ create-tag : true
236237 version-command : |
237238 python -c "from pathlib import Path;print(p_version.read_text().split('VERSION = \"')[1].split('\"')[0] if (p_version:=Path('src/bioimageio/spec/_version.py')).exists() else Path('src/bioimageio/spec/__init__.py').read_text().split('__version__ = \"')[1].split('\"')[0])"
238- - name : Push tag
239- id : tag-version
240- if : github.ref == 'refs/heads/main' && steps.check-version.outputs.previous-version != steps.check-version.outputs.current-version
241- uses :
mathieudutour/[email protected] 242- with :
243- github_token : ${{ secrets.GITHUB_TOKEN }}
244- custom_tag : ${{ steps.check-version.outputs.current-version }}
245239 - uses : actions/download-artifact@v4
246- if : github.ref == 'refs/heads/main' && steps.tag-version.outputs.new_tag
240+ if : github.ref == 'refs/heads/main' && steps.tag-version.outputs.tag
247241 with :
248242 name : dist
249243 - name : Publish package on PyPI
250- if : github.ref == 'refs/heads/main' && steps.tag-version.outputs.new_tag
244+ if : github.ref == 'refs/heads/main' && steps.tag-version.outputs.tag
251245 uses : pypa/gh-action-pypi-publish@release/v1
252246 with :
253247 packages-dir : dist/
@@ -256,7 +250,7 @@ jobs:
256250 if : github.ref == 'refs/heads/main'
257251 uses :
release-drafter/[email protected] 258252 with :
259- publish : " ${{ steps.tag-version.outputs.new_tag != '' }}"
260- tag : ' ${{ steps.tag-version.outputs.new_tag }}'
253+ publish : " ${{ steps.tag-version.outputs.tag != '' }}"
254+ tag : ' ${{ steps.tag-version.outputs.tag }}'
261255 env :
262256 GITHUB_TOKEN : ' ${{ secrets.GITHUB_TOKEN }}'
0 commit comments