Skip to content

Commit 9b29347

Browse files
authored
fix(ci): separated publish job (#75)
Signed-off-by: Ujjwal Kumar <[email protected]>
1 parent 2d6a886 commit 9b29347

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

.github/workflows/ci.yml

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
name: CI
2+
23
on:
34
push:
45
branches: [master]
56
tags: ['v*']
67
pull_request:
78
branches: [master]
9+
810
jobs:
911
test:
1012
runs-on: ubuntu-latest
@@ -44,15 +46,30 @@ jobs:
4446
@semantic-release/exec \
4547
@semantic-release/git \
4648
@semantic-release/github
49+
4750
- name: Semantic Release
4851
if: github.ref == 'refs/heads/master' && matrix.python-version == '3.8'
4952
env:
5053
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5154
GH_TOKEN: ${{ secrets.GH_TOKEN }}
5255
run: npx semantic-release
53-
- name: Publish to PyPI
54-
if: startsWith(github.ref, 'refs/tags/') && matrix.python-version == '3.8'
56+
57+
# Separate job for PyPI publishing
58+
publish:
59+
needs: test
60+
if: startsWith(github.ref, 'refs/tags/')
61+
runs-on: ubuntu-latest
62+
environment: ci
63+
steps:
64+
- uses: actions/checkout@v3
65+
- name: Set up Python
66+
uses: actions/setup-python@v4
67+
with:
68+
python-version: '3.8'
69+
- name: Install dependencies
5570
run: |
5671
pip install build twine
72+
- name: Build and publish
73+
run: |
5774
python -m build
58-
python -m twine upload dist/* -u __token__ -p ${{ secrets.PYPI_TOKEN }}
75+
python -m twine upload dist/* -u __token__ -p ${{ secrets.PYPI_TOKEN }}

0 commit comments

Comments
 (0)