Skip to content

Merge pull request #34 from buvis/dev-0.1.4 #48

Merge pull request #34 from buvis/dev-0.1.4

Merge pull request #34 from buvis/dev-0.1.4 #48

---
name: Build & maybe upload PyPI package
on:
push:
branches: [main]
tags: ["*"]
release:
types:
- published
workflow_dispatch:
permissions:
attestations: write
contents: read
id-token: write
jobs:
build-package:
name: Build & verify package
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: hynek/build-and-inspect-python-package@v2
with:
attest-build-provenance-github: "true"
release-test-pypi:
name: Publish in-dev package to test.pypi.org
environment: release-test-pypi
runs-on: ubuntu-latest
needs: build-package
steps:
- name: Check version change
uses: raven-wing/did-python-package-version-change@v1
id: did-version-change
- name: Download packages built by build-and-inspect-python-package
if: steps.did-version-change.outputs.is_version_greater == 'true'
uses: actions/download-artifact@v4
with:
name: Packages
path: dist
- name: Upload package to Test PyPI
if: steps.did-version-change.outputs.is_version_greater == 'true'
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
release-pypi:
name: Publish released package to pypi.org
environment: release-pypi
if: github.event.action == 'published'
runs-on: ubuntu-latest
needs: build-package
steps:
- name: Check version change
uses: raven-wing/did-python-package-version-change@v1
id: did-version-change
- name: Download packages built by build-and-inspect-python-package
if: steps.did-version-change.outputs.is_version_greater == 'true'
uses: actions/download-artifact@v4
with:
name: Packages
path: dist
- name: Upload package to PyPI
if: steps.did-version-change.outputs.is_version_greater == 'true'
uses: pypa/gh-action-pypi-publish@release/v1