Remove cosign signing in favor of GitHub native attestation (#148)

* Initial plan

* Remove cosign signing and improve GoReleaser configuration

- Removed cosign-installer step from release workflow
- Removed cosign signing sections (signs and docker_signs) from .goreleaser.yml
- Added include_meta: true to release configuration
- Added use: github and format to changelog configuration
- Added before hooks section for go mod tidy and go generate
- Improved comments and structure following best practices
- Added proper step names to workflow for better readability
- Kept attestation steps for checksums.txt and digests.txt using GitHub's native attestation

Co-authored-by: Belphemur <197810+Belphemur@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Belphemur <197810+Belphemur@users.noreply.github.com>
This commit is contained in:
Copilot
2025-12-10 16:39:25 -05:00
committed by GitHub
parent aefadafc7d
commit 8c52010dfe
2 changed files with 55 additions and 46 deletions

View File

@@ -28,28 +28,32 @@ jobs:
with: with:
go-version-file: go.mod go-version-file: go.mod
cache: true cache: true
- uses: sigstore/cosign-installer@v4.0.0 # installs cosign - name: Install Syft
- uses: anchore/sbom-action/download-syft@v0.20.11 # installs syft uses: anchore/sbom-action/download-syft@v0.20.11 # installs syft
- name: Set up QEMU - name: Set up QEMU
uses: docker/setup-qemu-action@v3 uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3 uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3 # login to ghcr - name: Log in to GHCR
uses: docker/login-action@v3 # login to ghcr
with: with:
registry: ghcr.io registry: ghcr.io
username: ${{ github.repository_owner }} username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }} password: ${{ secrets.GITHUB_TOKEN }}
- uses: goreleaser/goreleaser-action@v6 # run goreleaser - name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6 # run goreleaser
with: with:
version: nightly version: nightly
args: release --clean --verbose args: release --clean --verbose
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# After GoReleaser runs, attest all the files in ./dist/checksums.txt: # After GoReleaser runs, attest all the files in ./dist/checksums.txt:
- uses: actions/attest-build-provenance@v3 - name: Attest Build Provenance for Archives
uses: actions/attest-build-provenance@v3
with: with:
subject-checksums: ./dist/checksums.txt subject-checksums: ./dist/checksums.txt
# After GoReleaser runs, attest all the images in ./dist/digests.txt: # After GoReleaser runs, attest all the images in ./dist/digests.txt:
- uses: actions/attest-build-provenance@v3 - name: Attest Build Provenance for Docker Images
uses: actions/attest-build-provenance@v3
with: with:
subject-checksums: ./dist/digests.txt subject-checksums: ./dist/digests.txt

View File

@@ -1,10 +1,20 @@
# .goreleaser.yml # .goreleaser.yml
version: 2 version: 2
project_name: CBZOptimizer project_name: CBZOptimizer
# Configures the release process on GitHub
# https://goreleaser.com/customization/release/
release: release:
github: github:
owner: belphemur owner: belphemur
name: CBZOptimizer name: CBZOptimizer
include_meta: true
# draft: false # Default is false
# prerelease: auto # Default is auto
# mode: replace # Default is append
# Configures the binary archive generation
# https://goreleaser.com/customization/archive/
archives: archives:
- ids: - ids:
- cbzoptimizer - cbzoptimizer
@@ -14,7 +24,11 @@ archives:
goos: windows goos: windows
formats: ["zip"] # Plural form, multiple formats. Since: v2.6 formats: ["zip"] # Plural form, multiple formats. Since: v2.6
# Configures the changelog generation
# https://goreleaser.com/customization/changelog/
changelog: changelog:
use: github
format: "{{.SHA}}: {{.Message}} (@{{.AuthorUsername}})"
sort: asc sort: asc
filters: filters:
exclude: exclude:
@@ -31,6 +45,16 @@ changelog:
- title: "Performance" - title: "Performance"
regexp: '^.*?perf(\([[:word:]]+\))??!?:.+$' regexp: '^.*?perf(\([[:word:]]+\))??!?:.+$'
order: 2 order: 2
# Hooks to run before the build process starts
# https://goreleaser.com/customization/hooks/
before:
hooks:
- go mod tidy
- go generate ./...
# Configures the Go build process
# https://goreleaser.com/customization/build/
builds: builds:
- id: cbzoptimizer - id: cbzoptimizer
main: cmd/cbzoptimizer/main.go main: cmd/cbzoptimizer/main.go
@@ -72,29 +96,37 @@ builds:
- -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{ .CommitDate }} - -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{ .CommitDate }}
env: env:
- CGO_ENABLED=0 - CGO_ENABLED=0
# config the checksum filename
# https://goreleaser.com/customization/checksum # Configures the checksum file generation
# https://goreleaser.com/customization/checksum/
checksum: checksum:
name_template: "checksums.txt" name_template: "checksums.txt"
# Change the digests filename:
# Change the digests filename for attestation
# https://goreleaser.com/customization/docker_digest/
docker_digest: docker_digest:
name_template: "digests.txt" name_template: "digests.txt"
# create a source tarball
# Creates a source code archive (tar.gz and zip)
# https://goreleaser.com/customization/source/ # https://goreleaser.com/customization/source/
source: source:
enabled: true enabled: true
# proxies from the go mod proxy before building
# https://goreleaser.com/customization/gomod # Configures Go Modules settings
# https://goreleaser.com/customization/gomod/
gomod: gomod:
proxy: true proxy: true
# creates SBOMs of all archives and the source tarball using syft
# https://goreleaser.com/customization/sbom # Creates SBOMs (Software Bill of Materials)
# https://goreleaser.com/customization/sbom/
sboms: sboms:
- artifacts: archive - id: archive # Default ID for archive SBOMs
- id: source # Two different sbom configurations need two different IDs artifacts: archive # Generate SBOMs for binary archives using Syft
artifacts: source - id: source # Unique ID for source SBOM
# create a docker image artifacts: source # Generate SBOM for the source code archive
# https://goreleaser.com/customization/docker
# Creates Docker images and pushes them to registries using Docker v2 API
# https://goreleaser.com/customization/docker/
dockers_v2: dockers_v2:
- id: cbzoptimizer-image - id: cbzoptimizer-image
ids: ids:
@@ -122,30 +154,3 @@ dockers_v2:
"org.opencontainers.image.version": "{{.Version}}" "org.opencontainers.image.version": "{{.Version}}"
"org.opencontainers.image.source": "{{.GitURL}}" "org.opencontainers.image.source": "{{.GitURL}}"
"org.opencontainers.image.description": "CBZOptimizer is a Go-based tool designed to optimize CBZ (Comic Book Zip) and CBR (Comic Book RAR) files by converting images to a specified format and quality. This tool is useful for reducing the size of comic book archives while maintaining acceptable image quality." "org.opencontainers.image.description": "CBZOptimizer is a Go-based tool designed to optimize CBZ (Comic Book Zip) and CBR (Comic Book RAR) files by converting images to a specified format and quality. This tool is useful for reducing the size of comic book archives while maintaining acceptable image quality."
# signs the checksum file
# all files (including the sboms) are included in the checksum, so we don't need to sign each one if we don't want to
# https://goreleaser.com/customization/sign
signs:
- cmd: cosign
env:
- COSIGN_EXPERIMENTAL=1
certificate: "${artifact}.pem"
args:
- sign-blob
- "--output-certificate=${certificate}"
- "--output-signature=${signature}"
- "${artifact}"
- "--yes" # needed on cosign 2.0.0+
artifacts: checksum
output: true
# signs our docker image
# https://goreleaser.com/customization/docker_sign
docker_signs:
- cmd: cosign
env:
- COSIGN_EXPERIMENTAL=1
output: true
args:
- "sign"
- "${artifact}"
- "--yes" # needed on cosign 2.0.0+