Skip to content
Closed
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
54 changes: 54 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Release to PyPI

on:
workflow_dispatch:
inputs:
version:
description: "Version to release (e.g., v1.0.0)"
required: true

jobs:
release:
runs-on: ubuntu-latest
environment: release
permissions:
id-token: write
contents: write
actions: read

steps:
# Checkout the repository
- name: Checkout repository
uses: actions/checkout@v3

# Set up Python
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.x

# Install dependencies
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build

# Create a tag for the release
- name: Create and push tag
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config user.name "GitHub Actions"
git config user.email "actions@github.com"
git checkout main
git pull
git tag ${{ github.event.inputs.version }}
git push origin ${{ github.event.inputs.version }}

# Build the package
- name: Build package
run: python -m build

# Upload to PyPI
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1