Skip to content

Update release workflow #9

Update release workflow

Update release workflow #9

Workflow file for this run

name: Publish Python Package
on:
push:
branches:
- 'main'
release:
types: [published]
jobs:
build:
name: Build distribution 📦
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install build dependencies
run: >-
python3 -m pip install build --user
- name: Build a source distribution and a wheel
run: python3 -m build
- name: Store the distribution packages
uses: actions/upload-artifact@v3
with:
name: python-package-distributions
path: dist/
publish-to-pypi:
name: >-
Publish Python 🐍 distribution PyPI
needs:
- build
runs-on: ubuntu-latest
environment:
name: release
url: https://pypi.org/p/weco
permissions:
id-token: write
steps:
- name: Download the dists
uses: actions/download-artifact@v3
with:
name: python-package-distributions
path: dist/
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
github-release:
name: >-
Create GitHub Release
needs:
- publish-to-pypi
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
steps:
- name: Download dists
uses: actions/download-artifact@v3
with:
name: python-package-distributions
path: dist/
- name: Sign dists with Sigstore
uses: sigstore/[email protected]
with:
inputs: >-
./dist/*.tar.gz
./dist/*.whl
- name: Debug Print github.ref_name
run: >-
echo "github.ref_name: ${{ github.ref_name }}"
- name: Create GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
run: >-
gh release create
'v0.1.7'
--repo '${{ github.repository }}'
--notes ""
- name: Upload artifact signatures to GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
# Upload to GitHub Release using the `gh` CLI.
# `dist/` contains the built packages, and the
# sigstore-produced signatures and certificates.
run: >-
gh release upload
'v0.1.7' dist/**
--repo '${{ github.repository }}'