Update ghcr.io/a-h/templ:latest Docker digest to 60a60ff (#239) #127
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- "*" | |
pull_request: | |
branches: | |
- main | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
concurrency: | |
group: ${{ github.ref_name }}-ci | |
cancel-in-progress: true | |
permissions: | |
contents: read | |
jobs: | |
binary: | |
runs-on: ubuntu-24.04 | |
permissions: | |
contents: read | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
fetch-depth: 0 | |
- name: Setup Golang Environment | |
uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0 | |
with: | |
go-version: stable | |
- name: Run GoReleaser | |
uses: goreleaser/goreleaser-action@90a3faa9d0182683851fbfa97ca1a2cb983bfca3 # v6.2.1 | |
with: | |
version: latest | |
args: ${{ github.ref_type == 'tag' && 'release' || 'build --snapshot' }} --clean | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
build-and-push-image: | |
runs-on: ubuntu-24.04 | |
permissions: | |
contents: read | |
packages: write | |
attestations: write | |
id-token: write | |
security-events: write | |
services: | |
registry: | |
image: registry:2@sha256:a3d8aaa63ed8681a604f1dea0aa03f100d5895b6a58ace528858a7b332415373 | |
ports: | |
- 5000:5000 | |
needs: binary | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: Setup QEMU | |
uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3.6.0 | |
- name: Docker Buildx | |
uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3.10.0 | |
with: | |
version: latest | |
driver-opts: network=host | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
if: github.event_name != 'pull_request' | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@902fa8ec7d6ecbf8d84d538b9b233a880e428804 # v5.7.0 | |
with: | |
images: | | |
name=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }},enable=${{ github.event_name != 'pull_request' }} | |
name=localhost:5000/tailout/tailout-local | |
tags: | | |
type=edge | |
type=ref,event=pr | |
type=semver,pattern={{version}} | |
- name: Build and push Docker image | |
id: push | |
uses: docker/build-push-action@471d1dc4e07e5cdedd4c2171150001c434f0b7a4 # v6.15.0 | |
with: | |
context: . | |
push: true | |
pull: true | |
platforms: linux/amd64,linux/arm64 | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
annotations: ${{ steps.meta.outputs.annotations }} | |
cache-from: type=gha,scope=tailout | |
cache-to: type=gha,scope=tailout,mode=max | |
no-cache: ${{ github.event_name != 'pull_request' }} | |
provenance: mode=max | |
sbom: true | |
- name: Inspect SBOM and output manifest | |
run: | | |
docker buildx imagetools inspect localhost:5000/tailout/tailout-local:${{ steps.meta.outputs.version }} --format '{{ json (index .SBOM "linux/amd64").SPDX }}' > sbom.json | |
docker buildx imagetools inspect localhost:5000/tailout/tailout-local:${{ steps.meta.outputs.version }} --raw | |
- name: Scan SBOM | |
id: scan | |
uses: anchore/scan-action@7c05671ae9be166aeb155bad2d7df9121823df32 # v6.1.0 | |
with: | |
sbom: "sbom.json" | |
only-fixed: true | |
add-cpes-if-none: true | |
fail-build: false | |
- name: Upload scan result to GitHub Security tab | |
uses: github/codeql-action/upload-sarif@5f8171a638ada777af81d42b55959a643bb29017 # v3.28.12 | |
continue-on-error: true | |
with: | |
sarif_file: ${{ steps.scan.outputs.sarif }} | |
- name: Generate artifact attestation | |
uses: actions/attest-build-provenance@c074443f1aee8d4aeeae555aebba3282517141b2 # v2.2.3 | |
with: | |
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}} | |
subject-digest: ${{ steps.push.outputs.digest }} | |
push-to-registry: true | |
if: github.event_name != 'pull_request' |