Skip to content

Commit

Permalink
ci: add trusted publisher and attestations (#44)
Browse files Browse the repository at this point in the history
Signed-off-by: Henry Schreiner <[email protected]>
  • Loading branch information
henryiii authored Oct 8, 2024
1 parent 72c5230 commit 57dd621
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 22 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: CD

on:
workflow_dispatch:
release:
types:
- published

jobs:
dist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: hynek/build-and-inspect-python-package@v2


deploy:
if: github.event_name == 'release' && github.event.action == 'published'
needs: [dist]
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/scikit-build-core
permissions:
id-token: write
attestations: write

steps:
- uses: actions/download-artifact@v4
with:
name: Packages
path: dist

- name: Generate artifact attestation for sdist and wheel
uses: actions/attest-build-provenance@v1
with:
subject-path: "dist/*"

- uses: pypa/gh-action-pypi-publish@release/v1
with:
attestations: true
22 changes: 0 additions & 22 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,25 +48,3 @@ jobs:
- name: Test with pytest
run: |
pytest --cov=formulate --verbose
dist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v2

- name: Install wheel and sdist requirements
run: python -m pip install "build"

- name: Build sdist and wheel
run: python3 -m build

- uses: actions/upload-artifact@v4
with:
path: dist

- uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.pypi_password }}
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')

0 comments on commit 57dd621

Please sign in to comment.