Skip to content

Commit

Permalink
Update pypi workflow so I can create releases via github web instead.
Browse files Browse the repository at this point in the history
  • Loading branch information
magico13 committed Mar 3, 2024
1 parent 02427e0 commit 31492b8
Showing 1 changed file with 12 additions and 16 deletions.
28 changes: 12 additions & 16 deletions .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: Publish Python 🐍 distribution πŸ“¦ to PyPI and TestPyPI
name: Publish distribution to PyPI and TestPyPI

on: push

jobs:
build:
name: Build distribution πŸ“¦
name: Build distribution
runs-on: ubuntu-latest

steps:
Expand All @@ -21,7 +21,11 @@ jobs:
--user
- name: Set development version
run: >-
if [ "${{ github.ref }}" != "refs/heads/master" ]; then
if [ "${{ github.ref }}" == "refs/heads/master" ]; then
# If the branch is master, set to a release candidate version
sed -i "s/VERSION = \".*\"/VERSION = \"$(cat pyemvue/__version__.py | grep -oP '(?<=VERSION = \").*(?=\")').rc${{ github.run_number }}\"/" pyemvue/__version__.py
elif [ "${{ github.ref }}" != "refs/tags/*" ]; then
# If the branch is not master and not a tag, set to a development version
sed -i "s/VERSION = \".*\"/VERSION = \"$(cat pyemvue/__version__.py | grep -oP '(?<=VERSION = \").*(?=\")').dev${{ github.run_number }}\"/" pyemvue/__version__.py
fi
- name: Build a binary wheel and a source tarball
Expand All @@ -34,7 +38,7 @@ jobs:

publish-to-pypi:
name: >-
Publish Python 🐍 distribution πŸ“¦ to PyPI
Publish to PyPI
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
needs:
- build
Expand All @@ -51,12 +55,12 @@ jobs:
with:
name: python-package-distributions
path: dist/
- name: Publish distribution πŸ“¦ to PyPI
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1

github-release:
name: >-
Sign the Python 🐍 distribution πŸ“¦ with Sigstore
Sign the distribution with Sigstore
and upload them to GitHub Release
needs:
- publish-to-pypi
Expand All @@ -78,14 +82,6 @@ jobs:
inputs: >-
./dist/*.tar.gz
./dist/*.whl
- name: Create GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
run: >-
gh release create
'${{ github.ref_name }}'
--repo '${{ github.repository }}'
--notes ""
- name: Upload artifact signatures to GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
Expand All @@ -98,7 +94,7 @@ jobs:
--repo '${{ github.repository }}'
publish-to-testpypi:
name: Publish Python 🐍 distribution πŸ“¦ to TestPyPI
name: Publish to TestPyPI
needs:
- build
runs-on: ubuntu-latest
Expand All @@ -116,7 +112,7 @@ jobs:
with:
name: python-package-distributions
path: dist/
- name: Publish distribution πŸ“¦ to TestPyPI
- name: Publish distribution to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/

0 comments on commit 31492b8

Please sign in to comment.