Skip to content

Commit

Permalink
Put GitHub Action to publish to PyPI in separate workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
medihack committed Jan 3, 2025
1 parent c794146 commit 5596687
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 29 deletions.
32 changes: 3 additions & 29 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: CI
name: Run Continuous Integration
on:
pull_request:
push:
branches: [main]
tags: ["[0-9]+.[0-9]+.[0-9]+"]
pull_request:
branches: [main]
jobs:
ci:
strategy:
Expand Down Expand Up @@ -43,29 +43,3 @@ jobs:
- name: Stop PostgreSQL container
if: ${{ always() }}
run: docker compose down --remove-orphans --volumes
publish:
name: Publish package to PyPI
if: github.event_name == 'push' && github.ref_type == 'tag'
runs-on: ubuntu-latest
environment: release
permissions:
id-token: write
needs:
- ci
steps:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Set up Poetry
uses: abatilo/actions-poetry@v3
with:
poetry-version: "1.8.2"
- name: Add poetry dynamic versioning plugin
run: poetry self add poetry-dynamic-versioning
- name: Checkout repository
uses: actions/checkout@v4
- name: Build wheel and sdist
run: poetry build
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
29 changes: 29 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Build and Publish Package to PyPI
on:
release:
types: [published]
jobs:
publish:
runs-on: ubuntu-latest
environment: release
permissions:
id-token: write
needs:
- ci
steps:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Set up Poetry
uses: abatilo/actions-poetry@v3
with:
poetry-version: "1.8.2"
- name: Add poetry dynamic versioning plugin
run: poetry self add poetry-dynamic-versioning
- name: Checkout repository
uses: actions/checkout@v4
- name: Build wheel and sdist
run: poetry build
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1

0 comments on commit 5596687

Please sign in to comment.