Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
branches: ["*"]
pull_request:
branches: [master]
workflow_call:

jobs:
linux:
Expand Down
70 changes: 58 additions & 12 deletions .github/workflows/pypipublish.yaml
Original file line number Diff line number Diff line change
@@ -1,26 +1,72 @@
name: Upload Python Package
name: Release Python Package

# Triggered by a tag push, this workflow creates a GitHub release
# and publishes the package to PyPI.
on:
release:
types: [created]
push:
tags:
- '2[0-9][0-9][0-9].[0-9].[0-9]*'
- '2[0-9][0-9][0-9].[0-9][0-9].[0-9]*'

jobs:
deploy:
ci:
uses: ./.github/workflows/main.yaml

build:
name: Build artifacts
needs: ci
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.x"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install hatch twine
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
hatch build
twine upload dist/*
pip install build
- name: Build
run: python -m build
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/

release:
name: Create Release
needs: build
if: "!contains(github.ref_name, 'dev') && github.event_name == 'push'"
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: dist
path: dist/
- name: Create Release
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
files: dist/*

publish:
name: Upload release to PyPI
needs: release
runs-on: ubuntu-latest
permissions:
id-token: write
environment: pypi
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: dist
path: dist/
- name: Publish
uses: pypa/gh-action-pypi-publish@release/v1
Loading