Skip to content

Commit

Permalink
ci: update publish workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
disrupted committed Dec 20, 2024
1 parent 61005e0 commit ceed699
Showing 1 changed file with 7 additions and 42 deletions.
49 changes: 7 additions & 42 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,54 +12,19 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
python-version: "3.12"

- name: Get Python version
id: python-version
run: echo version="$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))")" >> "$GITHUB_OUTPUT"

- name: Run Poetry image
uses: abatilo/[email protected]
with:
poetry-version: "1.1.12"

- name: Set Poetry virtualenv
run: poetry config virtualenvs.in-project true

- name: Set up cache
uses: actions/cache@v4
id: cache
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.python-version.outputs.version }}-${{ hashFiles('poetry.lock') }}

- name: Ensure cache is healthy
if: steps.cache.outputs.cache-hit == 'true'
shell: bash
run: timeout 10s python -m poetry run pip --version || rm -rf .venv

- name: Install dependencies
run: poetry install --no-interaction

# - name: Bump version
# env:
# VERSION: ${{ github.event.release.tag_name }}
# run: poetry version $(echo $VERSION | sed -e 's/^v//')
version: latest

- name: Build
run: poetry build
run: uv build

- name: Publish TestPyPI
run: uv publish --trusted-publishing always -r testpypi
env:
POETRY_REPOSITORIES_TESTPYPI_URL: https://test.pypi.org/legacy/
POETRY_HTTP_BASIC_TESTPYPI_USERNAME: __token__
POETRY_HTTP_BASIC_TESTPYPI_PASSWORD: ${{ secrets.TEST_PYPI_API_TOKEN }}
run: poetry publish -r testpypi
UV_PUBLISH_URL: https://test.pypi.org/legacy/

- name: Publish PyPI
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_API_TOKEN }}
run: poetry publish
run: uv publish --trusted-publishing always

0 comments on commit ceed699

Please sign in to comment.