Skip to content

Commit 37d41f0

Browse files
committed
Modify deploy job
1 parent 7c27f22 commit 37d41f0

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

.github/workflows/deploy-job.yml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
name: Build, Test, Deploy
22

3-
on: [push]
3+
on:
4+
push:
5+
branches:
6+
- main
47

58
jobs:
69
info:
@@ -54,22 +57,31 @@ jobs:
5457
python3 -m pytest -sr tests/test_c*.py
5558
deploy:
5659
runs-on: ubuntu-latest
60+
if: github.ref == 'refs/heads/main'
5761
needs: test
5862
steps:
5963
- uses: actions/checkout@v3
64+
- name: Verify Changed files
65+
uses: tj-actions/verify-changed-files@v16
66+
id: verify-changed-files
67+
with:
68+
files: |
69+
src/**/*.py
70+
setup.cfg
6071
- name: Download artifacts
72+
if: steps.verify-changed-files.outputs.files_changed == 'true'
6173
uses: actions/download-artifact@v3
6274
with:
6375
name: built-artifacts
6476
path: dist
6577
- name: Publish package to Test PyPI
66-
if: github.ref == 'refs/heads/main'
78+
if: steps.verify-changed-files.outputs.files_changed == 'true'
6779
uses: pypa/gh-action-pypi-publish@release/v1
6880
with:
6981
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
7082
repository-url: https://test.pypi.org/legacy/
7183
- name: Publish package to PyPI
72-
if: github.ref == 'refs/heads/main'
84+
if: steps.verify-changed-files.outputs.files_changed == 'true'
7385
uses: pypa/gh-action-pypi-publish@release/v1
7486
with:
7587
password: ${{ secrets.PYPI_API_TOKEN }}

0 commit comments

Comments
 (0)