Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ jobs:
matrix:
binary:
- go-cli-github
- another-binary
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
with:
Expand Down
28 changes: 20 additions & 8 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,20 +63,32 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_SBOM_PATH: ./sbom.spdx.json
# attest archives
- uses: actions/attest-build-provenance@49df96e17e918a15956db358890b08e61c704919 # v1.2.0
with:
subject-path: "dist/*.tar.gz"
# parse artifacts to the format required for image attestation
- run: |
echo "digest=$(echo "$ARTIFACTS" | jq -r '.[]|select(.type=="Docker Manifest")|select(.name|test(":v"))|.extra.Digest')" >> "$GITHUB_OUTPUT"
echo "name=$(echo "$ARTIFACTS" | jq -r '.[]|select(.type=="Docker Manifest")|select(.name|test(":v"))|.name|split(":")[0]')" >> "$GITHUB_OUTPUT"
id: image_metadata
echo "$ARTIFACTS"
echo "digest=$(echo "$ARTIFACTS" | jq -r '.[]|select(.type=="Docker Manifest")|select(.name|test("go-cli-github:v"))|.extra.Digest')" >> "$GITHUB_OUTPUT"
echo "name=$(echo "$ARTIFACTS" | jq -r '.[]|select(.type=="Docker Manifest")|select(.name|test("go-cli-github:v"))|.name|split(":")[0]')" >> "$GITHUB_OUTPUT"
id: image_metadata_go_cli_github
env:
ARTIFACTS: ${{steps.goreleaser.outputs.artifacts}}
# attest archives
- run: |
echo "digest=$(echo "$ARTIFACTS" | jq -r '.[]|select(.type=="Docker Manifest")|select(.name|test("another-binary:v"))|.extra.Digest')" >> "$GITHUB_OUTPUT"
echo "name=$(echo "$ARTIFACTS" | jq -r '.[]|select(.type=="Docker Manifest")|select(.name|test("another-binary:v"))|.name|split(":")[0]')" >> "$GITHUB_OUTPUT"
id: image_metadata_another_binary
env:
ARTIFACTS: ${{steps.goreleaser.outputs.artifacts}}
# attest images
- uses: actions/attest-build-provenance@49df96e17e918a15956db358890b08e61c704919 # v1.2.0
with:
subject-path: "dist/*.tar.gz"
# attest images
subject-digest: ${{steps.image_metadata_go_cli_github.outputs.digest}}
subject-name: ${{steps.image_metadata_go_cli_github.outputs.name}}
push-to-registry: true
- uses: actions/attest-build-provenance@49df96e17e918a15956db358890b08e61c704919 # v1.2.0
with:
subject-digest: ${{steps.image_metadata.outputs.digest}}
subject-name: ${{steps.image_metadata.outputs.name}}
subject-digest: ${{steps.image_metadata_another_binary.outputs.digest}}
subject-name: ${{steps.image_metadata_another_binary.outputs.name}}
push-to-registry: true
32 changes: 31 additions & 1 deletion .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
version: 2
builds:
- id: go-cli-github
- &buildDefinition
id: go-cli-github
binary: go-cli-github
main: ./cmd/go-cli-github
ldflags:
Expand All @@ -19,6 +20,10 @@ builds:
goarch:
- amd64
- arm64
- <<: *buildDefinition
id: another-binary
binary: another-binary
main: ./cmd/another-binary

changelog:
use: github-native
Expand All @@ -41,6 +46,23 @@ dockers:
build_flag_templates:
- "--build-arg=BINARY=go-cli-github"
- "--platform=linux/arm64/v8"
- ids:
- another-binary
image_templates:
- "ghcr.io/{{ .Env.GITHUB_REPOSITORY }}/another-binary:v{{ .Version }}-amd64"
use: buildx
build_flag_templates:
- "--build-arg=BINARY=another-binary"
- "--platform=linux/amd64"
- ids:
- another-binary
image_templates:
- "ghcr.io/{{ .Env.GITHUB_REPOSITORY }}/another-binary:v{{ .Version }}-arm64v8"
use: buildx
goarch: arm64
build_flag_templates:
- "--build-arg=BINARY=another-binary"
- "--platform=linux/arm64/v8"

docker_manifests:
- name_template: "ghcr.io/{{ .Env.GITHUB_REPOSITORY }}/go-cli-github:v{{ .Version }}"
Expand All @@ -51,6 +73,14 @@ docker_manifests:
image_templates:
- "ghcr.io/{{ .Env.GITHUB_REPOSITORY }}/go-cli-github:v{{ .Version }}-amd64"
- "ghcr.io/{{ .Env.GITHUB_REPOSITORY }}/go-cli-github:v{{ .Version }}-arm64v8"
- name_template: "ghcr.io/{{ .Env.GITHUB_REPOSITORY }}/another-binary:v{{ .Version }}"
image_templates:
- "ghcr.io/{{ .Env.GITHUB_REPOSITORY }}/another-binary:v{{ .Version }}-amd64"
- "ghcr.io/{{ .Env.GITHUB_REPOSITORY }}/another-binary:v{{ .Version }}-arm64v8"
- name_template: "ghcr.io/{{ .Env.GITHUB_REPOSITORY }}/another-binary:latest"
image_templates:
- "ghcr.io/{{ .Env.GITHUB_REPOSITORY }}/another-binary:v{{ .Version }}-amd64"
- "ghcr.io/{{ .Env.GITHUB_REPOSITORY }}/another-binary:v{{ .Version }}-arm64v8"

release:
extra_files:
Expand Down
8 changes: 8 additions & 0 deletions cmd/another-binary/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Package main implements the command-line interface of a server.
package main

import "fmt"

func main() {
fmt.Println("Hello, World!")
}