Skip to content

Commit

Permalink
refactor: CI deploy with matrix for each job
Browse files Browse the repository at this point in the history
  • Loading branch information
r-leyshon committed Jul 4, 2024
1 parent 33399d7 commit 03584b2
Showing 1 changed file with 23 additions and 21 deletions.
44 changes: 23 additions & 21 deletions .github/workflows/build-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,15 @@ on:
tags:
- v*.*.*
jobs:
build:
name: ${{ matrix.os }}
runs-on: ubuntu-latest
timeout-minutes: 30
upload:
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11"]
runs-on: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.runs-on }}
timeout-minutes: 30
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # sha for 4.1.7
- name: Set up Python ${{ matrix.python-version }}
- name: Set up Python 3.11
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # sha for 5.1.0
with:
python-version: 3.11
Expand All @@ -47,33 +45,37 @@ jobs:
publish-to-pypi:
name: >-
Publish Python 🐍 distribution 📦 to PyPI
strategy:
matrix:
runs-on: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.runs-on }}
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/assess-gtfs # Replace <package-name> with your PyPI project name
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
contents: write
pages: write
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
contents: write
pages: write
steps:
- name: Download all the dists
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
with:
path: dist/
pattern: python-package-distributions-${{ matrix.runs-on }}
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@ec4db0b4ddc65acdf4bff5fa45ac92d78b56bdf0 # v1.9.0
- name: Download all the dists
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
with:
path: dist/
pattern: python-package-distributions-${{ matrix.runs-on }}
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@ec4db0b4ddc65acdf4bff5fa45ac92d78b56bdf0 # v1.9.0

github-release:
name: >-
Sign the Python 🐍 distribution 📦 with Sigstore
and upload them to GitHub Release
strategy:
matrix:
runs-on: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.runs-on }}
needs:
- publish-to-pypi
runs-on: ubuntu-latest
permissions:
contents: write # IMPORTANT: mandatory for making GitHub Releases
id-token: write # IMPORTANT: mandatory for sigstore
Expand Down

0 comments on commit 03584b2

Please sign in to comment.