Skip to content

Commit

Permalink
ci: publish when semantic versioned tag is pushed
Browse files Browse the repository at this point in the history
  • Loading branch information
thijstriemstra committed Feb 20, 2023
1 parent 4398fa7 commit d5477d4
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ name: Publish Package

on:
push:
branches:
- master
tags:
- '[0-9]+.[0-9]+.[0-9]+'

jobs:
build-and-publish:
Expand All @@ -17,20 +17,22 @@ jobs:
python-version: 3.9
- name: Install pypa/build
run: |
python -m pip install --upgrade setuptools pip wheel
python -m pip install --upgrade setuptools pip wheel twine
python -m pip install build --user
- name: Build a binary wheel and a source tarball
run: python -m build --sdist --wheel --outdir dist/ .
run: |
python -m build --sdist --wheel --outdir dist/ .
twine check --strict dist/*
- name: Publish package to test PyPI
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@master
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/
- name: Publish package to PyPI
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@master
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
Expand Down

0 comments on commit d5477d4

Please sign in to comment.