|
29 | 29 | build:
|
30 | 30 | name: Build Python distribution
|
31 | 31 | runs-on: ubuntu-latest
|
| 32 | + permissions: |
| 33 | + id-token: write |
| 34 | + attestations: write |
| 35 | + contents: read |
| 36 | + |
32 | 37 | steps:
|
33 | 38 | - uses: actions/checkout@v4
|
34 | 39 | with:
|
@@ -96,6 +101,16 @@ jobs:
|
96 | 101 | - name: List contents of wheel
|
97 | 102 | run: python -m zipfile --list dist/pyhf-*.whl
|
98 | 103 |
|
| 104 | + - name: Generate artifact attestation for sdist and wheel |
| 105 | + # If publishing to TestPyPI or PyPI |
| 106 | + if: >- |
| 107 | + (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && github.repository == 'scikit-hep/pyhf') |
| 108 | + || (github.event_name == 'workflow_dispatch' && github.event.inputs.publish == 'true' && github.repository == 'scikit-hep/pyhf') |
| 109 | + || (github.event_name == 'release' && github.event.action == 'published' && github.repository == 'scikit-hep/pyhf') |
| 110 | + uses: actions/attest-build-provenance@173725a1209d09b31f9d30a3890cf2757ebbff0d # v1.1.2 |
| 111 | + with: |
| 112 | + subject-path: "dist/pyhf-*" |
| 113 | + |
99 | 114 | - name: Upload distribution artifact
|
100 | 115 | uses: actions/upload-artifact@v4
|
101 | 116 | with:
|
@@ -125,6 +140,26 @@ jobs:
|
125 | 140 | - name: List all files
|
126 | 141 | run: ls -lh dist
|
127 | 142 |
|
| 143 | + - name: Verify sdist artifact attestation |
| 144 | + # If publishing to TestPyPI or PyPI |
| 145 | + if: >- |
| 146 | + (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && github.repository == 'scikit-hep/pyhf') |
| 147 | + || (github.event_name == 'workflow_dispatch' && github.event.inputs.publish == 'true' && github.repository == 'scikit-hep/pyhf') |
| 148 | + || (github.event_name == 'release' && github.event.action == 'published' && github.repository == 'scikit-hep/pyhf') |
| 149 | + env: |
| 150 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 151 | + run: gh attestation verify dist/pyhf-*.tar.gz --repo ${{ github.repository }} |
| 152 | + |
| 153 | + - name: Verify wheel artifact attestation |
| 154 | + # If publishing to TestPyPI or PyPI |
| 155 | + if: >- |
| 156 | + (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && github.repository == 'scikit-hep/pyhf') |
| 157 | + || (github.event_name == 'workflow_dispatch' && github.event.inputs.publish == 'true' && github.repository == 'scikit-hep/pyhf') |
| 158 | + || (github.event_name == 'release' && github.event.action == 'published' && github.repository == 'scikit-hep/pyhf') |
| 159 | + env: |
| 160 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 161 | + run: gh attestation verify dist/pyhf-*.whl --repo ${{ github.repository }} |
| 162 | + |
128 | 163 | - name: Publish distribution 📦 to Test PyPI
|
129 | 164 | # Publish to TestPyPI on tag events of if manually triggered
|
130 | 165 | # Compare to 'true' string as booleans get turned into strings in the console
|
|
0 commit comments