Skip to content

Release to PyPi

Release to PyPi #14

Workflow file for this run

# Checkout master, create sdist and bdist, and release to pypi
name: Release to PyPi
on:
workflow_dispatch:
inputs:
pypi-target:
description: Deploy to PyPi [Main] or [Test]
required: true
default: 'Main'
push:
tags:
- v*.*
jobs:
validations:
uses: ./.github/workflows/validate-pr-commit.yml
deploy-pypi:
name: Build ${{ matrix.os }} Python ${{ matrix.python-version }}
needs: [validations]
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-20.04, windows-latest, macos-latest ]
python-version: ["3.11"]
steps:
- name: restore artifact
uses: actions/download-artifact@v3
with:
name: setup-artifact-${{ matrix.os }}-py${{ matrix.python-version }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/[email protected]
with:
python-version: '${{ matrix.python-version }}'
check-latest: true
- if: success() && matrix.os != 'windows-latest'
name: extract and build
run: |
tar -xf boatest.tar.gz
cd boatest
source venv/bin/activate
pip install wheel
make build
- if: success() && matrix.os == 'windows-latest'
name: extract and build
run: |
tar -xf boatest.tar.gz
cd boatest
venv\Scripts\activate
pip install wheel
make build
- name: Validate dist
run: |
pip install twine
twine check boatest/dist/*
- name: Draft release
uses: softprops/action-gh-release@v1
with:
tag_name: Draft
name: Draft
draft: true
files: |
boatest/dist/*.whl
env:
GITHUB_TOKEN: ${{ secrets.deploy }}
- if: github.event.inputs.pypi-target == 'Main' || github.event_name == 'push'
name: Publish to PyPi
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
twine upload boatest/dist/*.whl
- if: github.event.inputs.pypi-target == 'Test'
name: Publish to Test-PyPi
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TEST_API_TOKEN }}
run: |
twine upload --repository testpypi boatest/dist/*.whl