diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml deleted file mode 100644 index 0c36fedc..00000000 --- a/.github/workflows/python-publish.yml +++ /dev/null @@ -1,31 +0,0 @@ -# This workflows will upload a Python Package using Twine when a release is created -# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries - -name: Upload Python Package - -on: - release: - types: [created] - -jobs: - deploy: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: '3.x' - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install setuptools wheel twine - - name: Build and publish - env: - TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} - TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} - run: | - python setup.py sdist bdist_wheel - twine upload dist/* diff --git a/.github/workflows/test.yml b/.github/workflows/test_and_deploy.yml similarity index 55% rename from .github/workflows/test.yml rename to .github/workflows/test_and_deploy.yml index 8b21094c..7475e3f8 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test_and_deploy.yml @@ -1,9 +1,11 @@ -name: CI +name: test_and_deploy on: push: branches: - main + tags: + - "v*" # Push events to matching v*, i.e. v1.0, v20.15.10 pull_request: jobs: @@ -48,7 +50,7 @@ jobs: parallel: true path-to-lcov: coverage.lcov - finish: + coveralls: needs: test runs-on: ubuntu-latest steps: @@ -57,3 +59,32 @@ jobs: with: github-token: ${{ secrets.github_token }} parallel-finished: true + + deploy: + # This will upload a Python Package using Twine when a release is created + # For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries + # + # This job will run when you have tagged a commit, starting with "v*" + # or created a release in GitHub which includes a tag starting with "v*" + # and requires that you have put your twine API key in your + # github secrets (see readme for details) + needs: [test] + runs-on: ubuntu-latest + if: contains(github.ref, 'tags') + steps: + - uses: actions/checkout@v3 + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.x' + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install setuptools wheel twine + - name: Build and publish + env: + TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} + TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} + run: | + python setup.py sdist bdist_wheel + twine upload dist/*