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

feat: add attestation to installer #17827

Merged
merged 11 commits into from
Aug 19, 2024
16 changes: 16 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ jobs:
fail-fast: false
matrix:
version: ["18.04", "20.04", "22.04", "24.04"]
permissions:
contents: read # for code access
attestations: write # for actions/attest-build-provenance
id-token: write # for actions/attest-build-provenance
steps:
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
Expand Down Expand Up @@ -52,6 +56,18 @@ jobs:
- name: Run brew test-bot --only-setup
run: docker run --rm brew brew test-bot --only-setup

- name: Generate image digest
id: digest
run: echo "digest=$(docker image inspect --format='{{.Digest}}' brew)" >> "$GITHUB_OUTPUT"

- name: Generate build provenance
uses: actions/attest-build-provenance@5e9cb68e95676991667494a6a4e59b8a2f13e1d0 # v1.3.3
id: attest
with:
subject-name: ghcr.io/homebrew/ubuntu${{matrix.version}}
subject-digest: ${{ steps.digest.outputs.digest }}
push-to-registry: ${{ startsWith(github.ref, 'refs/tags/') }}

- name: Deploy the tagged Docker image to GitHub Packages
if: startsWith(github.ref, 'refs/tags/')
run: |
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/pkg-installer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ jobs:
build:
if: github.repository_owner == 'Homebrew'
runs-on: macos-latest
permissions:
contents: read # for code access
attestations: write # for actions/attest-build-provenance
id-token: write # for actions/attest-build-provenance
outputs:
installer_path: "Homebrew-${{ steps.homebrew-version.outputs.version }}.pkg"
env:
Expand Down Expand Up @@ -119,6 +123,11 @@ jobs:
security delete-keychain "${RUNNER_TEMP}/${TEMPORARY_KEYCHAIN_FILE}"
fi

- name: Generate build provenance
uses: actions/attest-build-provenance@5e9cb68e95676991667494a6a4e59b8a2f13e1d0 # v1.3.3
with:
subject-path: Homebrew-${{ steps.homebrew-version.outputs.version }}.pkg

- name: Upload installer to GitHub Actions
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4
with:
Expand Down
Loading