Skip to content

Setup publish action #1

Setup publish action

Setup publish action #1

Workflow file for this run

name: Publish to PyPI
on:
push:
tags:
- '[0-9]+\.[0-9]+\.[0-9]+(\.(dev|rc|beta|alpha)[0-9]+)?'
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build twine toml
- name: Update pyproject.toml version
env:
TAG_NAME: ${{ github.ref_name }}
run: |
python -c "
import toml

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

View workflow run for this annotation

GitHub Actions / .github/workflows/publish.yml

Invalid workflow file

You have an error in your yaml syntax on line 31
with open('pyproject.toml', 'r') as f:
config = toml.load(f)
config['project']['version'] = '${{ env.TAG_NAME }}'
with open('pyproject.toml', 'w') as f:
toml.dump(config, f)
"
- name: Build package
run: python -m build
- name: Publish to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: python -m twine upload dist/*
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
files: |
dist/*