Skip to content

Build package

Build package #6

name: Build package
on:
workflow_dispatch:
inputs:
can_publish:
description: 'Publish built distributions'
type: boolean
required: true
default: true
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- uses: actions/setup-python@v5
with:
cache: pip
cache-dependency-path: pyproject.toml
python-version: '3.11'
- run: pip install build
- run: python -m build
- uses: actions/upload-artifact@v4
with:
name: dist-${{ runner.os }}
path: dist/
publish:
if: ${{ inputs.can_publish }}
environment: release
runs-on: ubuntu-latest
permissions:
id-token: write
needs:
- build
steps:
- uses: actions/download-artifact@v4
with:
pattern: dist-*
path: dist/
merge-multiple: true
- uses: pypa/gh-action-pypi-publish@v1.12.3