Skip to content

Commit f595d3f

Browse files
Publish to pypi on tag pushes (#1)
1 parent 8f6459c commit f595d3f

1 file changed

Lines changed: 11 additions & 12 deletions

File tree

.github/workflows/release.yml

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
name: Publish Python 🐍 distribution 📦 to PyPI
1+
name: Publish Python Package
22

33
on:
44
push:
5-
branches:
6-
- main
5+
tags:
6+
- 'v*.*.*'
77

88
release:
99
types: [published]
@@ -32,7 +32,7 @@ jobs:
3232

3333
publish-to-pypi:
3434
name: >-
35-
Publish Python 🐍 distribution 📦 to PyPI
35+
Publish Python 🐍 distribution PyPI
3636
needs:
3737
- build
3838
runs-on: ubuntu-latest
@@ -43,17 +43,17 @@ jobs:
4343
id-token: write
4444

4545
steps:
46-
- name: Download all the dists
46+
- name: Download the dists
4747
uses: actions/download-artifact@v3
4848
with:
4949
name: python-package-distributions
5050
path: dist/
51-
- name: Publish distribution 📦 to PyPI
51+
- name: Publish to PyPI
5252
uses: pypa/gh-action-pypi-publish@release/v1
5353

5454
github-release:
5555
name: >-
56-
Sign Python 🐍 distribution 📦 and create GitHub Release
56+
Create GitHub Release
5757
needs:
5858
- publish-to-pypi
5959
runs-on: ubuntu-latest
@@ -63,12 +63,12 @@ jobs:
6363
id-token: write
6464

6565
steps:
66-
- name: Download all the dists
66+
- name: Download dists
6767
uses: actions/download-artifact@v3
6868
with:
6969
name: python-package-distributions
7070
path: dist/
71-
- name: Sign the dists with Sigstore
71+
- name: Sign dists with Sigstore
7272
uses: sigstore/gh-action-sigstore-python@v2.1.1
7373
with:
7474
inputs: >-
@@ -78,9 +78,8 @@ jobs:
7878
env:
7979
GITHUB_TOKEN: ${{ github.token }}
8080
run: >-
81-
LATEST_TAG=$(git describe --tags --abbrev=0)
8281
gh release create
83-
"$LATEST_TAG"
82+
'{{ github.event.release.tag_name }}'
8483
--repo '${{ github.repository }}'
8584
--notes ""
8685
- name: Upload artifact signatures to GitHub Release
@@ -91,5 +90,5 @@ jobs:
9190
# sigstore-produced signatures and certificates.
9291
run: >-
9392
gh release upload
94-
"$LATEST_TAG" dist/**
93+
'{{ github.event.release.tag_name }}' dist/**
9594
--repo '${{ github.repository }}'

0 commit comments

Comments
 (0)