Skip to content

trigger on tag push, too #268

trigger on tag push, too

trigger on tag push, too #268

Workflow file for this run

name: Test, Build, and Publish
on:
pull_request:
push:
branches:
- main
tags:
- 'v*'
jobs:
build_wheels:
environment: Build
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
continue-on-error: true
strategy:
matrix:
os: [macos-latest, ubuntu-latest] # windows-latest
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Build wheels
uses: pypa/cibuildwheel@v2.13.0 # see pyproject.toml for config
- uses: actions/upload-artifact@v2
if: ${{ cancelled() || failure() || success() }}
with:
path: |
./wheelhouse/*.whl
./*.tar.gz
upload_pypi:
needs: [build_wheels]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v2
id: download
with:
name: artifact
path: dist
- name: Show artifact directory structure
run: |
find ${{ steps.download.outputs.download-path }}
echo 'Github event info:'
echo ${{github.event_name}}
echo ${{github.event.ref}}
- name: Publish distribution 📦 to Test PyPI
# upload to Test PyPI on every tag NOT starting with 'v'
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v') != true
# alternatively, to publish when a GitHub Release is not created, use the following rule:
# if: github.event_name != 'release' || github.event.action != 'published'
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.TEST_PYPI_TOKEN }}
repository-url: https://test.pypi.org/legacy/
packages-dir: dist/wheelhouse/
verbose: true
- name: Publish distribution 📦 to PyPI
# upload to PyPI on every tag starting with 'v'
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
# alternatively, to publish when a GitHub Release is created, use the following rule:
# if: github.event_name == 'release' && github.event.action == 'published'
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
packages-dir: dist/wheelhouse/
verbose: true