File tree Expand file tree Collapse file tree 1 file changed +20
-5
lines changed Expand file tree Collapse file tree 1 file changed +20
-5
lines changed Original file line number Diff line number Diff line change 11name : release
22on :
3+ workflow_dispatch :
4+ inputs :
5+ tag :
6+ description : ' Tag a publicar (e.g. v0.4.31)'
7+ required : false
38 push :
4- tags : ['v*']
9+ tags :
10+ - ' v*'
11+
512permissions :
613 contents : write
714 packages : write
15+
16+ env :
17+ TAG : ${{ github.ref_type == 'tag' && github.ref_name || inputs.tag }}
18+
819jobs :
920 build-publish :
1021 runs-on : ubuntu-latest
1122 steps :
1223 - uses : actions/checkout@v4
24+ with : { fetch-depth: 0 }
1325 - uses : actions/setup-python@v5
1426 with : { python-version: '3.12' }
15- - name : Build
27+ - name : Build sdist/wheel
1628 run : |
1729 python -m pip install -U pip build
1830 python -m build
1931 - uses : actions/upload-artifact@v4
2032 with : { name: dist, path: dist/* }
21- - name : Publish to PyPI
22- if : startsWith(github.ref , 'refs/tags/ v') && secrets.PYPI_API_TOKEN != ''
33+ - name : Publish to PyPI (guarded)
34+ if : ${{ env.TAG != '' && startsWith(env.TAG , 'v') && secrets.PYPI_API_TOKEN != '' }}
2335 uses : pypa/gh-action-pypi-publish@release/v1
2436 with :
2537 user : __token__
2638 password : ${{ secrets.PYPI_API_TOKEN }}
39+
2740 publish-ghcr :
2841 needs : build-publish
2942 runs-on : ubuntu-latest
4154 with :
4255 context : .
4356 push : true
44- tags : ghcr.io/${{ github.repository }}:latest,ghcr.io/${{ github.repository }}:${{ github.ref_name }}
57+ tags : |
58+ ghcr.io/${{ github.repository }}:latest
59+ ghcr.io/${{ github.repository }}:${{ env.TAG || github.ref_name }}
You can’t perform that action at this time.
0 commit comments