Skip to content

Publish v2.0.5 to PyPi by @george-zubrienko #26

Publish v2.0.5 to PyPi by @george-zubrienko

Publish v2.0.5 to PyPi by @george-zubrienko #26

Workflow file for this run

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@v3
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}'" > ./esd_services_api_client/_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