Skip to content

Commit

Permalink
Use goreleaser to autopopulate releases (#427)
Browse files Browse the repository at this point in the history
Also includes building container images to ghcr.io

Signed-off-by: Appu Goundan <appu@google.com>
  • Loading branch information
loosebazooka authored Apr 17, 2024
1 parent 56b620a commit 52e5d8e
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 0 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Create Release

on:
push:
tags:
- 'v*'

jobs:
release:
permissions:
contents: write
packages: write
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ structure_tests.test
.vscode
out/
bazel-*
dist/
56 changes: 56 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
project_name: container-structure-test

builds:
- env:
- CGO_ENABLED=0

main: ./cmd/container-structure-test

binary: container-structure-test-{{.Os}}-{{.Arch}}

ldflags:
- -X github.com/GoogleContainerTools/container-structure-test/pkg/version.version=12
- -X github.com/GoogleContainerTools/container-structure-test/pkg/version.buildDate={{.Date}}
- -X github.com/GoogleContainerTools/container-structure-test/pkg/version.builtBy=goreleaser
- -X github.com/GoogleContainerTools/container-structure-test/pkg/version.commit={{.Commit}}

targets:
- darwin_amd64
- darwin_arm64
- linux_amd64
- linux_arm64
- linux_s390x
- linux_ppc64le
- windows_amd64

no_unique_dist_dir: true

checksum:
name_template: "checksums.txt"

archives:
- format: binary
name_template: "{{ .Binary }}"

kos:
- repository: ghcr.io/GoogleContainerTools/container-structure-test
base_image: ubuntu:22.04
tags:
- '{{.Version}}'
- latest
bare: true
preserve_import_paths: false
platforms:
- linux/amd64
- linux/arm64
ldflags:
- -X github.com/GoogleContainerTools/container-structure-test/pkg/version.version=12
- -X github.com/GoogleContainerTools/container-structure-test/pkg/version.buildDate={{.Date}}
- -X github.com/GoogleContainerTools/container-structure-test/pkg/version.builtBy=goreleaser
- -X github.com/GoogleContainerTools/container-structure-test/pkg/version.commit={{.Commit}}

release:
footer: |
## Container Images
`ghcr.io/GoogleContainerTools/container-structure-test:{{.Version}}`

0 comments on commit 52e5d8e

Please sign in to comment.