diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..eb0d585 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,39 @@ +name: Release + +on: + push: + tags: + - '*.*.*' + +jobs: + release: + name: Release + runs-on: ubuntu-latest + steps: + # will use ref/SHA that triggered it + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up Python 3.9 + uses: actions/setup-python@v2 + with: + python-version: "3.9" + + - name: Install poetry + uses: abatilo/actions-poetry@v2.0.0 + with: + poetry-version: 1.1.11 + + - name: Build project for distribution + run: poetry build + + - name: Check Version + id: check-version + run: | + [[ "$(poetry version --short)" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] \ + || echo ::set-output name=prerelease::true + + - name: Publish to PyPI + env: + POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }} + run: poetry publish