diff --git a/.github/workflows/build-wheels.yml b/.github/workflows/build-wheels.yml deleted file mode 100644 index 472d500..0000000 --- a/.github/workflows/build-wheels.yml +++ /dev/null @@ -1,66 +0,0 @@ -name: Builds - -on: - push: - branches: - - master - pull_request: - # Run weekly at 1:23 UTC - release: - types: - - published - schedule: - - cron: '23 1 * * 0' - workflow_dispatch: - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Checkout repository and submodules - uses: actions/checkout@v4 - with: - submodules: recursive - - - name: Set up Python - uses: actions/setup-python@v5 - - - name: Display Python version - run: python --version - - - name: Build SDist and wheel - run: pipx run build - - - name: Check metadata - run: pipx run twine check --strict dist/* - - - name: List contents of sdist - run: python -m tarfile --list dist/*.tar.gz - - - name: List contents of wheel - run: python -m zipfile --list dist/*.whl - - - name: Upload to GitHub - uses: actions/upload-artifact@v4 - with: - name: Packages - path: dist/* - - upload_all: - 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: - pattern: cibw-* - path: dist - merge-multiple: true - - - uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..1d26e20 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,57 @@ +name: publish distributions + +on: + push: + branches: + - master + pull_request: + # Run weekly at 1:23 UTC + schedule: + - cron: '23 1 * * 0' + workflow_dispatch: + release: + types: + - published + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +permissions: + contents: read + +jobs: + dist: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - uses: hynek/build-and-inspect-python-package@v2 + + publish: + needs: [dist] + environment: pypi + permissions: + id-token: write + attestations: write + contents: read + runs-on: ubuntu-latest + if: github.repository_owner == 'thaler-lab' && github.event_name == 'release' && github.event.action == 'published' + + steps: + - uses: actions/download-artifact@v4 + with: + name: Packages + path: dist + + - name: Generate artifact attestation for sdist and wheel + uses: actions/attest-build-provenance@1c608d11d69870c2092266b3f9a6f3abbf17002c # v1.4.3 + with: + subject-path: "dist/*" + + - uses: pypa/gh-action-pypi-publish@release/v1 + with: + print-hash: true + attestations: true diff --git a/.github/workflows/upload-wheels.yml b/.github/workflows/upload-wheels.yml deleted file mode 100644 index 66a1fd1..0000000 --- a/.github/workflows/upload-wheels.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: Uploads - -on: - push: - branches: - - master - workflow_dispatch: - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - upload_all: - 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: - pattern: cibw-* - path: dist - merge-multiple: true - - - uses: pypa/gh-action-pypi-publish@release/v1