Skip to content

Publish Python Package #42

Publish Python Package

Publish Python Package #42

Workflow file for this run

name: Publish Python Package
on:
workflow_run:
workflows: [Run CI]
types:
- completed
push:
branches:
- main
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Check out the repository
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
export PATH="$HOME/.local/bin:$PATH"
- name: Install dependencies
run: |
poetry install --no-root -E playwright
- name: Build package
run: |
poetry build
- name: Publish to PyPI
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.DS_PYPI_API_TOKEN }}
run: |
poetry config http-basic.pypi "__token__" "${POETRY_PYPI_TOKEN_PYPI}"
poetry publish
- name: Get the version from pyproject.toml
id: get_version
run: |
echo "::set-output name=version::$(poetry version -s)"
- name: Create Git tag
env:
GITHUB_TOKEN: ${{ secrets.CI_TOKEN }}
run: |
git config user.name "github-actions"
git config user.email "[email protected]"
git tag -a v${{ steps.get_version.outputs.version }} -m "Release version ${{ steps.get_version.outputs.version }}"
git push https://x-access-token:${GITHUB_TOKEN}@github.com/lucaromagnoli/dataservice.git v${{ steps.get_version.outputs.version }}
- name: Create GitHub Release
uses: ncipollo/release-action@v1
with:
tag: v${{ steps.get_version.outputs.version }}
name: "Release ${{ steps.get_version.outputs.version }}"
body: "New release version ${{ steps.get_version.outputs.version }} is published"
draft: false
prerelease: false