Publish v3.3.9 to PyPi by @matt035343 #210
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish to PyPi | |
run-name: Publish ${{github.ref_name}} to PyPi by @${{ github.actor }} | |
on: workflow_dispatch | |
jobs: | |
release_to_pypi: | |
name: Release distribution to Pypi | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags') | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11.x' # Version range or exact version of a Python version to use, using SemVer's version range syntax | |
architecture: 'x64' # optional x64 or x86. Defaults to x64 if not specified | |
- name: Install and Configure Poetry and Prepare Publish | |
run: | | |
set -e | |
curl -sSL https://install.python-poetry.org | python3 - | |
version=$(git describe --tags --abbrev=7) | |
sed -i "s/version = \"0.0.0\"/version = \"${version:1}\"/" pyproject.toml | |
echo "__version__ = '${version:1}'" > ./adapta/_version.py | |
- name: Configure Test PyPi | |
if: ${{ github.ref == 'refs/heads/main' }} | |
env: | |
PYPI_TEST_TOKEN: ${{ secrets.PYPI_TEST_API_TOKEN }} | |
run: | | |
set -e | |
poetry config repositories.test-pypi https://test.pypi.org/legacy/ | |
poetry config pypi-token.test-pypi $PYPI_TEST_TOKEN | |
- name: Publish distribution 📦 to test PyPI | |
if: ${{ github.ref == 'refs/heads/main' }} | |
run: | | |
set -e | |
poetry build && poetry publish -r test-pypi | |
- name: Publish distribution 📦 to PyPI | |
env: | |
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_API_TOKEN }} | |
if: ${{ startsWith(github.ref, 'refs/tags') }} | |
run: | | |
set -e | |
poetry build && poetry publish |