diff --git a/.github/workflows/distribution.yml b/.github/workflows/distribution.yml index 447d704..61aa724 100644 --- a/.github/workflows/distribution.yml +++ b/.github/workflows/distribution.yml @@ -2,41 +2,47 @@ name: distribute on: workflow_dispatch: + pull_request: push: - tags: "v*" + branches: + - main release: types: - published +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +env: + FORCE_COLOR: 3 + jobs: dist: + name: Distribution build runs-on: ubuntu-latest + steps: - uses: actions/checkout@v4 with: fetch-depth: 0 - - name: Build SDist and wheel - run: pipx run build - - - uses: actions/upload-artifact@v4 - with: - path: dist/* - - - name: Check metadata - run: pipx run twine check dist/* + - uses: hynek/build-and-inspect-python-package@v2 publish: needs: [dist] + name: Publish to PyPI + environment: pypi + permissions: + id-token: write runs-on: ubuntu-latest if: github.event_name == 'release' && github.event.action == 'published' steps: - uses: actions/download-artifact@v4 with: - name: artifact + name: Packages path: dist - - uses: pypa/gh-action-pypi-publish@v1.8.11 - with: - password: ${{ secrets.pypi_password }} + - uses: pypa/gh-action-pypi-publish@release/v1 + if: github.event_name == 'release' && github.event.action == 'published' diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d79a065..4c66f2a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,18 +1,20 @@ name: leds on: + workflow_dispatch: + pull_request: push: branches: - main - "releases/**" - pull_request: - merge_group: - release: concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true +env: + FORCE_COLOR: 3 + jobs: build-and-test: name: Test leds with Python @@ -20,7 +22,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.9", "3.10"] + python-version: ["3.9", "3.10", "3.11"] os: [ubuntu-latest, macOS-latest] steps: @@ -29,13 +31,13 @@ jobs: uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - - name: Get dependencies and install the leds + - name: Get dependencies and install leds run: | python -m pip install --upgrade pip wheel setuptools python -m pip install --upgrade .[test] - name: Run unit tests run: | - pytest + python -m pytest build-docs: name: Build documentation