diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 16616f4..81eaad9 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -56,20 +56,34 @@ jobs: - publish-pypi runs-on: ubuntu-latest permissions: + actions: read contents: write id-token: write steps: - name: Download artifacts - uses: actions/download-artifact@v8.0.1 - with: - name: python-package-distributions - path: dist/ + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh run download \ + '${{ github.run_id }}' \ + --name python-package-distributions \ + --dir dist/ \ + --repo '${{ github.repository }}' + - name: Install sigstore-python + run: python3 -m pip install --upgrade sigstore - name: Sign the dists with Sigstore - uses: sigstore/gh-action-sigstore-python@v3.4.0 - with: - inputs: >- - ./dist/*.tar.gz - ./dist/*.whl + shell: bash + run: | + mapfile -t files < <(find ./dist -maxdepth 1 -type f \( -name '*.tar.gz' -o -name '*.whl' \) | sort) + if [ "${#files[@]}" -eq 0 ]; then + echo "No distribution artifacts found in ./dist/" + exit 1 + fi + echo "Found ${#files[@]} distribution artifacts to sign." + for file in "${files[@]}"; do + echo "Signing ${file}" + python3 -m sigstore sign "${file}" + done - name: Create GitHub Release env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}