Skip to content

Commit

Permalink
ci: Use commit timestamp as SOURCE_DATE_EPOCH for reproducible builds
Browse files Browse the repository at this point in the history
  • Loading branch information
JadedBlueEyes committed Jan 15, 2025
1 parent cbc45fe commit b9cd7f5
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/release-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ jobs:
"./target": "/app/target"
}
# skip-extraction: ${{ steps.rust-cache.outputs.cache-hit }}
# We get the git commit timestamp, to use for reproducible builds (SOURCE_DATE_EPOCH)
- name: Get Git commit timestamps
run: echo "TIMESTAMP=$(git log -1 --pretty=%ct)" >> $GITHUB_ENV
# This step uses the `docker/build-push-action` action to build the image, based on your repository's `Dockerfile`. If the build succeeds, it pushes the image to GitHub Packages.
# It uses the `context` parameter to define the build's context as the set of files located in the specified path. For more information, see "[Usage](https://github.com/docker/build-push-action#usage)" in the README of the `docker/build-push-action` repository.
# It uses the `tags` and `labels` parameters to tag and label the image with the output from the "meta" step.
Expand All @@ -111,6 +114,8 @@ jobs:
cache-from: type=gha
cache-to: type=gha,mode=max
sbom: true
env:
SOURCE_DATE_EPOCH: ${{ env.TIMESTAMP }}

# This step generates an artifact attestation for the image, which is an unforgeable statement about where and how it was built. It increases supply chain security for people who consume the image. For more information, see "[Using artifact attestations to establish provenance for builds](https://docs.github.com/en/actions/security-for-github-actions/using-artifact-attestations/using-artifact-attestations-to-establish-provenance-for-builds)."
- name: Generate artifact attestation (${{ steps.var.outputs.docker_image }})
Expand Down

0 comments on commit b9cd7f5

Please sign in to comment.