Skip to content

Add build dist workflow #1

Add build dist workflow

Add build dist workflow #1

Workflow file for this run

name: Publish to PyPI
on:
push:
branches:
- main
jobs:
build:
name: Build dist
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install pypa/build
run: |
python3 -m pip install build --user
- name: Build a binary wheel and a source tarball
run: python3 -m build
- name: Store the distribution packages
uses: actions/upload-artifact@v3
with:
name: python-package-distributions
path: dist/
publish:
name: Publish to PyPI
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
needs:
- build
runs-on: macos-latest
environment:
name: pypi
url: https://pypi.org/p/jaffle-shop-generator
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing
steps:
- name: Download all the dists
uses: actions/download-artifact@v3
with:
name: python-package-distributions
path: dist/
- name: Publish dist to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
github-release:
name: Publish GitHub Release
needs:
- publish-to-pypi

Check failure on line 53 in .github/workflows/publish.yml

View workflow run for this annotation

GitHub Actions / Publish to PyPI

Invalid workflow file

The workflow is not valid. .github/workflows/publish.yml (Line: 53, Col: 9): Job 'github-release' depends on unknown job 'publish-to-pypi'.
runs-on: macos-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/[email protected]
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 }}'