Skip to content

Commit e782c4c

Browse files
authored
update script
1 parent a2dbbae commit e782c4c

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

.github/workflows/build-test-deploy.yml

+23-2
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
name: Deploy and publish
4848
runs-on: ubuntu-latest
4949
needs: build_test
50-
if: "github.event_name == 'push'"
50+
if: "github.event_name == 'push' && github.ref == 'refs/heads/master' && !startsWith(github.event.head_commit.message, 'chore')"
5151
steps:
5252
- name: Setup Extensions
5353
uses: actions/checkout@v2
@@ -81,4 +81,25 @@ jobs:
8181
run: echo "NEXT_RELEASE=$(npx semantic-release --dry-run | grep -oP "Published release \K[0-9]+\.[0-9]+\.[0-9]+")" >> $GITHUB_OUTPUT
8282

8383
- name: Publish to git releases and tags
84-
run: echo "The next release is ${{ steps.next_release.outputs.NEXT_RELEASE }}"
84+
if: ${{ steps.next_release.outputs.NEXT_RELEASE != null }}
85+
env:
86+
GH_TOKEN: ${{ secrets.GH_TOKEN }}
87+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
88+
run: |
89+
echo "The next release is ${{ steps.next_release.outputs.NEXT_RELEASE }}"
90+
npx semantic-release
91+
92+
- name: Build project
93+
if: ${{ steps.next_release.outputs.NEXT_RELEASE != null }}
94+
run: |
95+
pip install -U pip
96+
pip install build
97+
python -m build
98+
99+
- name: Publish to pypi
100+
if: ${{ steps.next_release.outputs.NEXT_RELEASE != null }}
101+
uses: pypa/gh-action-pypi-publish@release/v1
102+
with:
103+
user: ${{ secrets.PYPI_USER }}
104+
password: ${{ secrets.PYPI_PASSWORD }}
105+
repository_url: https://upload.pypi.org/legacy/

0 commit comments

Comments
 (0)