diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..2ab7a16 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,40 @@ +name: publish + +on: [push, pull_request, workflow_dispatch] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + # include git history for setuptools-scm + fetch-depth: 20 + fetch-tags: true + + # work around a bug of checkout + # https://github.com/actions/checkout/issues/1467 + ref: ${{ github.ref }} + - name: Set up Python + uses: actions/setup-python@v3 + - name: build + run: | + python -m pip install build + python -m build + - name: dump result + run: | + ls -alh dist/ + find dist -name *.whl -print -exec unzip -l {} \; + find dist -name *.tar.gz -print -exec tar -ztvf {} \; + - uses: actions/upload-artifact@v4 + with: + name: dist + path: ./dist/* + - name: Publish to PyPI + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') + uses: pypa/gh-action-pypi-publish@release/v1 + with: + packages-dir: dist/ + skip-existing: true + user: __token__ + password: ${{ secrets.PYPI_API_TOKEN }}