Skip to content

Update publish.yml

Update publish.yml #4

Workflow file for this run

name: Publish Python Package
on:
push:
branches:
- master # or 'main', adjust to your default branch
jobs:
bump-version-and-publish-testpypi:
if: github.ref == 'refs/heads/master' # Only on pushes to master
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install bump2version and build tools
run: |
python -m pip install --upgrade pip
pip install bump2version==1.0.1 build twine
- name: Bump patch version, commit, and tag
env:

Check failure on line 26 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 26
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config user.name "github-actions"
git config user.email "[email protected]"
bump2version patch --allow-dirty --commit --tag
git push origin HEAD:master
git push --tags
- name: Build package
run: python -m build
- name: Upload to TestPyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_TOKEN }}
run: twine upload --repository-url https://test.pypi.org/legacy/ dist/*
publish-to-pypi:
if: startsWith(github.ref, 'refs/tags/v') # On version tags only
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install build tools
run: |
python -m pip install --upgrade pip
pip install build twine
- name: Build package
run: python -m build
- name: Upload to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: twine upload dist/*