Skip to content

Commit 4d1f671

Browse files
committed
fix(publish): combined release and publishing into a single step
Signed-off-by: Ujjwal Kumar <[email protected]>
1 parent 901800c commit 4d1f671

File tree

1 file changed

+9
-24
lines changed

1 file changed

+9
-24
lines changed

.github/workflows/ci.yml

Lines changed: 9 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: CI
33
on:
44
push:
55
branches: [master]
6-
tags: ['*']
6+
tags: ['v*']
77
pull_request:
88
branches: [master]
99

@@ -41,37 +41,22 @@ jobs:
4141
- name: Install release dependencies
4242
if: github.ref == 'refs/heads/master' && matrix.python-version == '3.8'
4343
run: |
44-
pip install bump-my-version
44+
pip install bump-my-version build twine
4545
sudo npm install -g semantic-release \
4646
@semantic-release/changelog \
4747
@semantic-release/exec \
4848
@semantic-release/git \
4949
@semantic-release/github
5050
51-
- name: Semantic Release
51+
- name: Semantic Release and Publish
5252
if: github.ref == 'refs/heads/master' && matrix.python-version == '3.8'
5353
env:
5454
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5555
GH_TOKEN: ${{ secrets.GH_TOKEN }}
56-
run: npx semantic-release
57-
58-
# Separate job for PyPI publishing
59-
publish:
60-
needs: test
61-
# Changed the condition to check for any tag
62-
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
63-
runs-on: ubuntu-latest
64-
environment: ci
65-
steps:
66-
- uses: actions/checkout@v3
67-
- name: Set up Python
68-
uses: actions/setup-python@v4
69-
with:
70-
python-version: '3.8'
71-
- name: Install dependencies
72-
run: |
73-
pip install build twine
74-
- name: Build and publish
7556
run: |
76-
python -m build
77-
python -m twine upload dist/* -u __token__ -p ${{ secrets.PYPI_TOKEN }}
57+
npx semantic-release
58+
# If semantic-release was successful, build and publish to PyPI
59+
if [ $? -eq 0 ]; then
60+
python -m build
61+
python -m twine upload dist/* -u __token__ -p ${{ secrets.PYPI_TOKEN }}
62+
fi

0 commit comments

Comments
 (0)