Skip to content

Commit

Permalink
fix(ci): separated publish job (#75)
Browse files Browse the repository at this point in the history
Signed-off-by: Ujjwal Kumar <[email protected]>
  • Loading branch information
uibm authored Jan 7, 2025
1 parent 2d6a886 commit 9b29347
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
name: CI

on:
push:
branches: [master]
tags: ['v*']
pull_request:
branches: [master]

jobs:
test:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -44,15 +46,30 @@ jobs:
@semantic-release/exec \
@semantic-release/git \
@semantic-release/github
- name: Semantic Release
if: github.ref == 'refs/heads/master' && matrix.python-version == '3.8'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_TOKEN: ${{ secrets.GH_TOKEN }}
run: npx semantic-release
- name: Publish to PyPI
if: startsWith(github.ref, 'refs/tags/') && matrix.python-version == '3.8'

# Separate job for PyPI publishing
publish:
needs: test
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
environment: ci
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.8'
- name: Install dependencies
run: |
pip install build twine
- name: Build and publish
run: |
python -m build
python -m twine upload dist/* -u __token__ -p ${{ secrets.PYPI_TOKEN }}
python -m twine upload dist/* -u __token__ -p ${{ secrets.PYPI_TOKEN }}

0 comments on commit 9b29347

Please sign in to comment.