Skip to content

Commit 86512a8

Browse files
committed
feat: mac universal binaries, docker, sboms, linux pkgs
1 parent 76a87bd commit 86512a8

File tree

3 files changed

+77
-1
lines changed

3 files changed

+77
-1
lines changed

.github/workflows/goreleaser.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010

1111
permissions:
1212
contents: write
13-
# packages: write
13+
packages: write
1414
# issues: write
1515
# id-token: write
1616

@@ -23,6 +23,14 @@ jobs:
2323
with:
2424
fetch-depth: 0
2525
- uses: oven-sh/[email protected]
26+
- uses: anchore/sbom-action/[email protected]
27+
- uses: docker/[email protected]
28+
- uses: docker/[email protected]
29+
- uses: docker/[email protected]
30+
with:
31+
registry: ghcr.io
32+
username: ${{ github.repository_owner }}
33+
password: ${{ secrets.GITHUB_TOKEN }}
2634
# More assembly might be required: Docker logins, GPG, etc.
2735
# It all depends on your needs.
2836
- name: Run GoReleaser

.goreleaser.yaml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88

99
version: 2
1010

11+
project_name: example
12+
13+
# Actually builds the binaries.
1114
builds:
1215
- builder: bun
1316
targets:
@@ -17,6 +20,7 @@ builds:
1720
- darwin-arm64
1821
- windows-x64-modern
1922

23+
# Creates archives for each target.
2024
archives:
2125
- format: tar.gz
2226
# this name template makes the OS and Arch compatible with the results of `uname`.
@@ -31,16 +35,77 @@ archives:
3135
- goos: windows
3236
format: zip
3337

38+
# Changelog configuration (will be in the github release).
3439
changelog:
3540
sort: asc
3641
filters:
3742
exclude:
3843
- "^docs:"
3944
- "^test:"
4045

46+
# A footer to add to all releases.
4147
release:
4248
footer: >-
4349
4450
---
4551
4652
Released by [GoReleaser](https://github.com/goreleaser/goreleaser).
53+
54+
# Creates Linux packages.
55+
nfpms:
56+
- file_name_template: "{{ .ConventionalFileName }}"
57+
maintainer: Carlos Alexandro Becker <[email protected]>
58+
formats:
59+
- deb
60+
- apk
61+
- rpm
62+
63+
# Creates Darwin universal binaries.
64+
universal_binaries:
65+
- replace: true
66+
67+
# Enables source archives.
68+
source:
69+
enabled: true
70+
71+
# SBOMs for the archives.
72+
sboms:
73+
- artifacts: archive
74+
75+
# Create Docker images.
76+
# We create a manifest below, so here the images need the suffix with the
77+
# architecture.
78+
dockers:
79+
- image_templates:
80+
- "ghcr.io/vedantmgoyal9/example-bun:{{ .Tag }}-arm64"
81+
dockerfile: Dockerfile
82+
goarch: arm64
83+
use: buildx
84+
build_flag_templates:
85+
- "--pull"
86+
- "--label=org.opencontainers.image.created={{.Date}}"
87+
- "--label=org.opencontainers.image.name={{.ProjectName}}"
88+
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
89+
- "--label=org.opencontainers.image.version={{.Version}}"
90+
- "--label=org.opencontainers.image.source={{.GitURL}}"
91+
- "--platform=linux/arm64"
92+
- image_templates:
93+
- "ghcr.io/vedantmgoyal9/example-bun:{{ .Tag }}-amd64"
94+
dockerfile: Dockerfile
95+
goarch: amd64
96+
use: buildx
97+
build_flag_templates:
98+
- "--pull"
99+
- "--label=org.opencontainers.image.created={{.Date}}"
100+
- "--label=org.opencontainers.image.name={{.ProjectName}}"
101+
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
102+
- "--label=org.opencontainers.image.version={{.Version}}"
103+
- "--label=org.opencontainers.image.source={{.GitURL}}"
104+
- "--platform=linux/amd64"
105+
106+
# Here we join both images into a Docker manifest.
107+
docker_manifests:
108+
- name_template: "ghcr.io/vedantmgoyal9/example-bun:{{ .Tag }}"
109+
image_templates:
110+
- "ghcr.io/vedantmgoyal9/example-bun:{{ .Tag }}-arm64"
111+
- "ghcr.io/vedantmgoyal9/example-bun:{{ .Tag }}-amd64"

Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
FROM debian:12-slim
2+
COPY example /usr/bin/example
3+
ENTRYPOINT [ "/usr/bin/example" ]

0 commit comments

Comments
 (0)