Skip to content

Commit f58f1c5

Browse files
committed
ci: change release workflow to be manual workflow_dispatch (4)
1 parent 198258b commit f58f1c5

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

.github/workflows/release.yaml

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,39 @@
11

2-
name: Publish to TestPyPI
2+
name: Publish to PyPI
33

44
on:
55
workflow_dispatch:
66
inputs:
77
dest:
8-
description: 'Destination (test.pypi.org or pypi.org)'
8+
description: 'Destination (testpypi or pypi)'
99
required: true
10-
default: 'test.pypi.org'
10+
default: 'testpypi'
1111
type: choice
1212
options:
13-
- test.pypi.org
14-
- pypi.org
13+
- testpypi
14+
- pypi
1515

1616
jobs:
1717
publish:
18-
name: Publish to TestPyPI
18+
name: Publish ${{ github.ref_name }} to ${{ inputs.dest=='pypi' && '' || 'Test ' }}PyPI
1919
runs-on: ubuntu-24.04
2020

2121
environment:
22-
name: testpypi
23-
url: https://test.pypi.org/p/jitxlib-deploytest1
22+
name: ${{ inputs.dest }}
23+
url: https://${{ inputs.dest=='pypi' && 'pypi.org' || 'test.pypi.org' }}/p/jitxlib-${{ github.repository }}
2424

2525
permissions:
2626
contents: read # for reading content from a repo
2727
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
2828

2929
steps:
3030

31-
- name: Debug Dump GitHub context
31+
- name: Ensure valid tag
32+
if: (! github.ref_type == 'tag') || (! startsWith(github.ref_name, 'v')) || contains(github.ref_name, '.dev')
3233
shell: bash
33-
env:
34-
GITHUB_CONTEXT: ${{ toJson(github) }}
35-
run: echo "$GITHUB_CONTEXT"
34+
run: |
35+
echo "Invalid tag for publishing: ${{ github.ref_name }}"
36+
exit -1
3637
3738
- name: Fetch Release
3839
uses: robinraju/release-downloader@v1
@@ -48,9 +49,9 @@ jobs:
4849
run: |
4950
ls -la dist/ || true
5051
51-
- name: Publish to Test PyPI
52+
- name: Publish to ${{ inputs.dest=='pypi' && '' || 'Test ' }}PyPI
5253
uses: pypa/gh-action-pypi-publish@release/v1
5354
with:
54-
repository-url: "https://${{ inputs.dest }}/legacy/"
55+
repository-url: "https://${{ inputs.dest=='pypi' && 'pypi.org' || 'test.pypi.org' }}/legacy/"
5556
packages-dir: dist/
5657

0 commit comments

Comments
 (0)