From 37d41f0e112f37085f3ecca87dbfde4932e7ad1e Mon Sep 17 00:00:00 2001 From: Pavel Dat Date: Tue, 12 Sep 2023 13:47:46 +0300 Subject: [PATCH] Modify deploy job --- .github/workflows/deploy-job.yml | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/.github/workflows/deploy-job.yml b/.github/workflows/deploy-job.yml index 07dfd6f..30cae39 100644 --- a/.github/workflows/deploy-job.yml +++ b/.github/workflows/deploy-job.yml @@ -1,6 +1,9 @@ name: Build, Test, Deploy -on: [push] +on: + push: + branches: + - main jobs: info: @@ -54,22 +57,31 @@ jobs: python3 -m pytest -sr tests/test_c*.py deploy: runs-on: ubuntu-latest + if: github.ref == 'refs/heads/main' needs: test steps: - uses: actions/checkout@v3 + - name: Verify Changed files + uses: tj-actions/verify-changed-files@v16 + id: verify-changed-files + with: + files: | + src/**/*.py + setup.cfg - name: Download artifacts + if: steps.verify-changed-files.outputs.files_changed == 'true' uses: actions/download-artifact@v3 with: name: built-artifacts path: dist - name: Publish package to Test PyPI - if: github.ref == 'refs/heads/main' + if: steps.verify-changed-files.outputs.files_changed == 'true' uses: pypa/gh-action-pypi-publish@release/v1 with: password: ${{ secrets.TEST_PYPI_API_TOKEN }} repository-url: https://test.pypi.org/legacy/ - name: Publish package to PyPI - if: github.ref == 'refs/heads/main' + if: steps.verify-changed-files.outputs.files_changed == 'true' uses: pypa/gh-action-pypi-publish@release/v1 with: password: ${{ secrets.PYPI_API_TOKEN }}