Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Attestations #1490

Merged
merged 16 commits into from
Jan 17, 2025
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -431,5 +431,6 @@ jobs:
contents: write
pages: write
id-token: write
attestations: write
secrets: inherit
uses: ./.github/workflows/release.yml
29 changes: 29 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ jobs:
environment: release
permissions:
id-token: write
attestations: write
steps:
- name: Download artifact
uses: actions/download-artifact@v4
Expand All @@ -22,6 +23,11 @@ jobs:
merge-multiple: true
path: wheelhouse

- name: Add attestations
uses: actions/attest-build-provenance@v1
with:
subject-path: wheelhouse/*.whl

- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
Expand Down Expand Up @@ -103,6 +109,7 @@ jobs:
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Push to Docker Hub
id: publish-docker-hub
run: |
tags=(${{ steps.tags.outputs.tags }})
for image in fasttrackml-oci-*.tar
Expand All @@ -118,6 +125,28 @@ jobs:
$(printf -- "--tag ${{ vars.DOCKER_REPO }}:%s " ${tags[@]}) \
$(printf "${{ vars.DOCKER_REPO }}@%s " ${digests[@]})
echo "::endgroup::"
# Output digests as a JSON array for use in a matrix
echo "digests=$(printf '%s\n' "${digests[@]}" | jq -R . | jq -s .)" >> $GITHUB_OUTPUT
outputs:
digests: ${{ steps.publish-docker-hub.outputs.digests }}

attest-docker-images:
name: Publish Docker images attestations
runs-on: ubuntu-latest
needs: docker-release
permissions:
id-token: write
jgiannuzzi marked this conversation as resolved.
Show resolved Hide resolved
attestations: write
strategy:
matrix:
digest: ${{ fromJson(needs.docker-release.outputs.digests) }}
steps:
- name: Attest Each Docker Image
uses: actions/attest-build-provenance@v2
with:
subject-name: index.docker.io/${{ vars.DOCKER_REPO }}
subject-digest: ${{ matrix.digest }}
push-to-registry: true

chart-release:
name: Publish Helm chart
Expand Down
Loading