Skip to content

Commit

Permalink
Update publish.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
GrimmXoXo authored Jul 10, 2024
1 parent 7d85e90 commit 9424480
Showing 1 changed file with 7 additions and 34 deletions.
41 changes: 7 additions & 34 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
name: Publish Python distribution to PyPI and TestPyPI

on:
release:
types: [published]
workflow_dispatch:
push:
branches:
- main #testing

jobs:
build:
Expand All @@ -18,6 +20,8 @@ jobs:
run: |
python3 -m pip install --upgrade pip
python3 -m pip install build --user
- name: Ensure dist directory exists
run: mkdir -p Project/dist
- name: Build a binary wheel and a source tarball
run: |
cd Project
Expand All @@ -37,7 +41,6 @@ jobs:

publish-to-pypi:
name: Publish Python distribution to PyPI
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
needs:
- build
runs-on: ubuntu-latest
Expand Down Expand Up @@ -65,39 +68,9 @@ jobs:
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://upload.pypi.org/legacy/
packages_dir: dist/

github-release:
name: Sign the Python distribution with Sigstore and upload them to GitHub Release
needs:
- publish-to-pypi
runs-on: ubuntu-latest
permissions:
contents: write # IMPORTANT: mandatory for making GitHub Releases
id-token: write # IMPORTANT: mandatory for sigstore
steps:
- name: Download all the dists
uses: actions/download-artifact@v3
with:
name: python-package-distributions
path: dist/
- name: Sign the dists with Sigstore
uses: sigstore/gh-action-sigstore-python@v2.1.1
with:
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 }}
run: |
gh release upload '${{ github.ref_name }}' dist/** --repo '${{ github.repository }}'
publish-to-testpypi:
name: Publish Python distribution to TestPyPI
needs:
Expand Down

0 comments on commit 9424480

Please sign in to comment.