Skip to content

0.0.50

0.0.50 #53

Workflow file for this run

name: Release to PyPI
on:
release:
types: [published]
jobs:
quality:
uses: ./.github/workflows/pull-request.yaml
release:
name: Build and Publish to PyPI
runs-on: ubuntu-latest
needs: [ quality ]
steps:
- uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.8"
- name: Auto set version from tag
# Ref: https://github.com/grst/python-ci-versioneer
run: |
# from refs/tags/1.2.3 get 1.2.3
VERSION=$(echo $GITHUB_REF | sed 's#.*/##')
echo "Setting version to $VERSION"
PLACEHOLDER='^version\s*=.*'
# ensure the placeholder is there. If grep doesn't find the placeholder
# it exits with exit code 1 and github actions aborts the build.
grep -E "$PLACEHOLDER" pyproject.toml
sed -i -e "s/^\(version\s*=\).*/\1 \"${VERSION}\"/g" pyproject.toml
shell: bash
- name: Install wheel
run: python3 -m pip install --upgrade build
- name: Build
run: python3 -m build
- name: Publish
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}