Skip to content

Commit

Permalink
πŸ”§ ci(publish-workflow): enhance github actions workflow configuration
Browse files Browse the repository at this point in the history
- add repository check step to validate main repository
- implement conditional builds and releases
- support publishing to PyPI and TestPyPI based on version check
- add post-release tasks for main repository
  • Loading branch information
awwaawwa committed Jan 24, 2025
1 parent 71f9e4c commit 3341a91
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,18 @@ permissions:
pull-requests: write

jobs:
check-repository:
name: Check if running in main repository
runs-on: ubuntu-latest
outputs:
is_main_repo: ${{ github.repository == 'funstory-ai/yadt' }}
steps:
- run: echo "Running repository check"

build:
name: Build distribution πŸ“¦
needs: check-repository
if: needs.check-repository.outputs.is_main_repo == 'true'
runs-on: ubuntu-latest
outputs:
is_release: ${{ steps.check-version.outputs.tag }}
Expand Down Expand Up @@ -67,6 +77,7 @@ jobs:
name: Publish Python 🐍 distribution πŸ“¦ to PyPI
if: needs.build.outputs.is_release != ''
needs:
- check-repository
- build
runs-on: ubuntu-latest
environment:
Expand All @@ -90,6 +101,7 @@ jobs:
name: Publish Python 🐍 distribution πŸ“¦ to TestPyPI
if: needs.build.outputs.is_release == ''
needs:
- check-repository
- build
runs-on: ubuntu-latest
environment:
Expand All @@ -114,7 +126,9 @@ jobs:
post-release:
name: Post Release Tasks
needs:
- check-repository
- build
if: needs.check-repository.outputs.is_main_repo == 'true'
runs-on: ubuntu-latest
permissions:
contents: write
Expand Down

0 comments on commit 3341a91

Please sign in to comment.