Skip to content

Publish to Pypi

Publish to Pypi #13

Workflow file for this run

---
name: Publish to Pypi
on:
workflow_dispatch:
jobs:
publish_wheels:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.8"
- name: Download artifact
id: download-artifact
uses: dawidd6/action-download-artifact@v2
with:
workflow: build-and-test.yaml
branch: main
name: (.*-wheel)|source-distribution
name_is_regexp: true
search_artifacts: true
- name: List artifacts
run: |
ls **/*.whl
ls source-distribution/*.tar.gz
- name: Extract version information
run: |
VERSION=$(python3 ./setup.py --version)
TAG=v$VERSION
echo "Version found: $VERSION"
echo "Using tag: $TAG"
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "TAG=v$VERSION" >> $GITHUB_ENV
if [[ "$VERSION" == *rc* ]]; then
echo "PRERELEASE=true" >> $GITHUB_ENV
echo "This is a prerelease."
else
echo "PRERELEASE=false" >> $GITHUB_ENV
echo "This is a full release."
fi
- name: Create Git tag
run: |
git tag $TAG
git push origin $TAG
- name: Create release
uses: softprops/action-gh-release@v2
with:
name: ${{ env.TAG }}
prerelease: ${{ env.PRERELEASE }}
draft: false
files: |
ubuntu-wheel/*.whl
macos-wheel/*.whl
windows-wheel/*.whl
source-distribution/*.tar.gz