From e7db820439a4d5ff5f5a0772df34626c4b2ac850 Mon Sep 17 00:00:00 2001 From: Daniel Stoops Date: Tue, 25 Jun 2024 08:33:27 +0300 Subject: [PATCH 1/2] Run ghactions on pull_request only --- .github/workflows/workflow.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 14830b2..35d8c8a 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -1,6 +1,6 @@ name: czml3 gh actions workflow -on: [push, pull_request] +on: [pull_request] jobs: build: From ae0ada5de2c6b074ac8a0ed400216a7b3af1e1cf Mon Sep 17 00:00:00 2001 From: Daniel Stoops Date: Tue, 25 Jun 2024 08:46:47 +0300 Subject: [PATCH 2/2] Publish to PyPi only on pushes to main branch --- .github/workflows/publish-to-pypi.yml | 50 +++++++++++++++++++++++++++ .github/workflows/workflow.yml | 49 +------------------------- 2 files changed, 51 insertions(+), 48 deletions(-) create mode 100644 .github/workflows/publish-to-pypi.yml diff --git a/.github/workflows/publish-to-pypi.yml b/.github/workflows/publish-to-pypi.yml new file mode 100644 index 0000000..dab4ef2 --- /dev/null +++ b/.github/workflows/publish-to-pypi.yml @@ -0,0 +1,50 @@ +name: Publish to PyPi + +on: + push: + branches: + - main +jobs: + build: + name: Build distribution 📦 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.11" + - name: Install pypa/build + run: >- + python3 -m + pip install + build + --user + - name: Build a binary wheel and a source tarball + run: python3 -m build + - name: Store the distribution packages + uses: actions/upload-artifact@v3 + with: + name: python-package-distributions + path: dist/ + + publish-to-pypi: + name: >- + Publish Python 🐍 distribution 📦 to PyPI + if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes + needs: + - build + runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/p/czml3 + permissions: + id-token: write # IMPORTANT: mandatory for trusted publishing + steps: + - name: Download all the dists + uses: actions/download-artifact@v3 + with: + name: python-package-distributions + path: dist/ + - name: Publish distribution 📦 to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 35d8c8a..c6a2bb5 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -1,60 +1,13 @@ -name: czml3 gh actions workflow +name: Run checks on: [pull_request] jobs: - build: - name: Build distribution 📦 - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: "3.11" - - name: Install pypa/build - run: >- - python3 -m - pip install - build - --user - - name: Build a binary wheel and a source tarball - run: python3 -m build - - name: Store the distribution packages - uses: actions/upload-artifact@v3 - with: - name: python-package-distributions - path: dist/ - - publish-to-pypi: - name: >- - Publish Python 🐍 distribution 📦 to PyPI - if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes - needs: - - build - runs-on: ubuntu-latest - environment: - name: pypi - url: https://pypi.org/p/czml3 - permissions: - id-token: write # IMPORTANT: mandatory for trusted publishing - - steps: - - name: Download all the dists - uses: actions/download-artifact@v3 - with: - name: python-package-distributions - path: dist/ - - name: Publish distribution 📦 to PyPI - uses: pypa/gh-action-pypi-publish@release/v1 - tox-checks: runs-on: ubuntu-latest strategy: matrix: python-version: ['3.7', '3.8', '3.9', '3.10', '3.11'] - steps: - uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }}