Skip to content

Commit 52e5d8e

Browse files
authored
Use goreleaser to autopopulate releases (#427)
Also includes building container images to ghcr.io Signed-off-by: Appu Goundan <[email protected]>
1 parent 56b620a commit 52e5d8e

File tree

3 files changed

+87
-0
lines changed

3 files changed

+87
-0
lines changed

.github/workflows/release.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Create Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
release:
10+
permissions:
11+
contents: write
12+
packages: write
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- name: Set up Go
19+
uses: actions/setup-go@v5
20+
with:
21+
go-version-file: 'go.mod'
22+
23+
- name: Run GoReleaser
24+
uses: goreleaser/goreleaser-action@v5
25+
with:
26+
distribution: goreleaser
27+
version: latest
28+
args: release --clean
29+
env:
30+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ structure_tests.test
44
.vscode
55
out/
66
bazel-*
7+
dist/

.goreleaser.yaml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
project_name: container-structure-test
2+
3+
builds:
4+
- env:
5+
- CGO_ENABLED=0
6+
7+
main: ./cmd/container-structure-test
8+
9+
binary: container-structure-test-{{.Os}}-{{.Arch}}
10+
11+
ldflags:
12+
- -X github.com/GoogleContainerTools/container-structure-test/pkg/version.version=12
13+
- -X github.com/GoogleContainerTools/container-structure-test/pkg/version.buildDate={{.Date}}
14+
- -X github.com/GoogleContainerTools/container-structure-test/pkg/version.builtBy=goreleaser
15+
- -X github.com/GoogleContainerTools/container-structure-test/pkg/version.commit={{.Commit}}
16+
17+
targets:
18+
- darwin_amd64
19+
- darwin_arm64
20+
- linux_amd64
21+
- linux_arm64
22+
- linux_s390x
23+
- linux_ppc64le
24+
- windows_amd64
25+
26+
no_unique_dist_dir: true
27+
28+
checksum:
29+
name_template: "checksums.txt"
30+
31+
archives:
32+
- format: binary
33+
name_template: "{{ .Binary }}"
34+
35+
kos:
36+
- repository: ghcr.io/GoogleContainerTools/container-structure-test
37+
base_image: ubuntu:22.04
38+
tags:
39+
- '{{.Version}}'
40+
- latest
41+
bare: true
42+
preserve_import_paths: false
43+
platforms:
44+
- linux/amd64
45+
- linux/arm64
46+
ldflags:
47+
- -X github.com/GoogleContainerTools/container-structure-test/pkg/version.version=12
48+
- -X github.com/GoogleContainerTools/container-structure-test/pkg/version.buildDate={{.Date}}
49+
- -X github.com/GoogleContainerTools/container-structure-test/pkg/version.builtBy=goreleaser
50+
- -X github.com/GoogleContainerTools/container-structure-test/pkg/version.commit={{.Commit}}
51+
52+
release:
53+
footer: |
54+
## Container Images
55+
56+
`ghcr.io/GoogleContainerTools/container-structure-test:{{.Version}}`

0 commit comments

Comments
 (0)