Skip to content

Commit 17d5d6c

Browse files
feat: armv7 and repo url
1 parent 6a55c84 commit 17d5d6c

File tree

7 files changed

+63
-25
lines changed

7 files changed

+63
-25
lines changed

.goreleaser.yaml

+29
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,23 @@ builds:
1717
- linux
1818
- windows
1919
- darwin
20+
goarch:
21+
- amd64
22+
- arm
23+
- arm64
24+
goarm:
25+
- 7
2026
ignore:
27+
- goos: windows
28+
goarch: arm
2129
- goos: windows
2230
goarch: arm64
2331
- goos: windows
2432
goarch: 386
2533
- goos: linux
2634
goarch: 386
35+
ldflags:
36+
- "-s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}} -X main.builtBy=goreleaser -X main.releaseURL={{.ReleaseURL}}"
2737
dockers:
2838
- image_templates:
2939
- ghcr.io/{{ .Env.REPO_OWNER }}/{{ .ProjectName }}:{{ .Version }}-amd64
@@ -56,15 +66,34 @@ dockers:
5666
- --label=org.opencontainers.image.created={{ .Date }}
5767
- --label=org.opencontainers.image.revision={{ .FullCommit }}
5868
- --label=org.opencontainers.image.licenses={{ .Env.LICENSES }}
69+
- goarch: arm
70+
goarm: 7
71+
image_templates:
72+
- ghcr.io/{{ .Env.REPO_OWNER }}/{{ .ProjectName }}:{{ .Version }}-armv7
73+
- ghcr.io/{{ .Env.REPO_OWNER }}/{{ .ProjectName }}:latest-armv7
74+
use: buildx
75+
build_flag_templates:
76+
- --pull
77+
- --platform=linux/arm/v7
78+
- --label=org.opencontainers.image.title={{ .ProjectName }}
79+
- --label=org.opencontainers.image.description=={{ .Env.DESCRIPTION }}
80+
- --label=org.opencontainers.image.url=https://github.com/{{ .Env.REPO_OWNER }}/{{ .ProjectName }}
81+
- --label=org.opencontainers.image.source=https://github.com/{{ .Env.REPO_OWNER }}/{{ .ProjectName }}
82+
- --label=org.opencontainers.image.version={{ .Version }}
83+
- --label=org.opencontainers.image.created={{ .Date }}
84+
- --label=org.opencontainers.image.revision={{ .FullCommit }}
85+
- --label=org.opencontainers.image.licenses={{ .Env.LICENSES }}
5986
docker_manifests:
6087
- name_template: ghcr.io/{{ .Env.REPO_OWNER }}/{{ .ProjectName }}:{{ .Version }}
6188
image_templates:
6289
- ghcr.io/{{ .Env.REPO_OWNER }}/{{ .ProjectName }}:{{ .Version }}-amd64
6390
- ghcr.io/{{ .Env.REPO_OWNER }}/{{ .ProjectName }}:{{ .Version }}-arm64v8
91+
- ghcr.io/{{ .Env.REPO_OWNER }}/{{ .ProjectName }}:{{ .Version }}-armv7
6492
- name_template: ghcr.io/{{ .Env.REPO_OWNER }}/{{ .ProjectName }}:latest
6593
image_templates:
6694
- ghcr.io/{{ .Env.REPO_OWNER }}/{{ .ProjectName }}:latest-amd64
6795
- ghcr.io/{{ .Env.REPO_OWNER }}/{{ .ProjectName }}:latest-arm64v8
96+
- ghcr.io/{{ .Env.REPO_OWNER }}/{{ .ProjectName }}:latest-armv7
6897
archives:
6998
- format: tar.gz
7099
# this name template makes the OS and Arch compatible with the results of uname.

internal/build/build.go

+14-7
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
11
package build
22

33
type Build struct {
4-
BuiltBy string
5-
Commit string
6-
Date string
7-
Version string
8-
RepoURL string
4+
BuiltBy string
5+
Commit string
6+
Date string
7+
Version string
8+
RepoURL string
9+
ReleaseURL string
910
}
1011

11-
var Current Build
12+
func (b Build) CommitURL() string {
13+
return b.RepoURL + "/tree/" + b.Commit
14+
}
1215

13-
var RepoURL string = "https://github.com/ItsNotGoodName/smtpbridge"
16+
func (b Build) LicenseURL() string {
17+
return b.CommitURL() + "/LICENSE"
18+
}
19+
20+
var Current Build

main.go

+12-8
Original file line numberDiff line numberDiff line change
@@ -84,19 +84,23 @@ func run(ctx context.Context, shutdown context.CancelFunc, cli config.CLI) <-cha
8484
}
8585

8686
var (
87-
version = "dev"
88-
commit = "none"
89-
date = "unknown"
90-
builtBy = "unknown"
87+
builtBy = "unknown"
88+
commit = ""
89+
date = ""
90+
version = "dev"
91+
repoURL = "https://github.com/ItsNotGoodName/smtpbridge"
92+
releaseURL = ""
9193
)
9294

9395
func init() {
9496
log.Logger = log.Output(zerolog.ConsoleWriter{Out: os.Stderr})
9597

9698
build.Current = build.Build{
97-
BuiltBy: builtBy,
98-
Commit: commit,
99-
Date: date,
100-
Version: version,
99+
BuiltBy: builtBy,
100+
Commit: commit,
101+
Date: date,
102+
Version: version,
103+
RepoURL: repoURL,
104+
ReleaseURL: releaseURL,
101105
}
102106
}

web/controllers/controllers.go

-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"net/http"
55
"strconv"
66

7-
"github.com/ItsNotGoodName/smtpbridge/internal/build"
87
"github.com/ItsNotGoodName/smtpbridge/internal/core"
98
"github.com/ItsNotGoodName/smtpbridge/internal/envelope"
109
"github.com/ItsNotGoodName/smtpbridge/internal/models"
@@ -31,7 +30,6 @@ func Index(retentionPolicy models.RetentionPolicy) func(c *fiber.Ctx, cc *core.C
3130
// Response
3231
return c.Render("index", fiber.Map{
3332
"Messages": messages.Messages,
34-
"Build": build.Current,
3533
"Storage": storage,
3634
"RetentionPolicy": retentionPolicy,
3735
})

web/helpers/helpers.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ import (
1212
)
1313

1414
var Map template.FuncMap = template.FuncMap{
15-
"repoURL": func() string {
16-
return build.RepoURL
15+
"build": func() build.Build {
16+
return build.Current
1717
},
1818
"development": func() bool {
1919
return web.Development

web/views/index.html

+4-4
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,19 @@ <h2>Build</h2>
2828
<tbody>
2929
<tr>
3030
<th scope="row"><strong>Built By</strong></th>
31-
<td>{{.Build.BuiltBy}}</td>
31+
<td>{{build.BuiltBy}}</td>
3232
</tr>
3333
<tr>
3434
<th scope="row"><strong>Commit</strong></th>
35-
<td><a href="{{repoURL}}/tree/{{.Build.Commit}}">{{.Build.Commit}}</a></td>
35+
<td><a href="{{build.CommitURL}}">{{build.Commit}}</a></td>
3636
</tr>
3737
<tr>
3838
<th scope="row"><strong>Date</strong></th>
39-
<td>{{.Build.Date}}</td>
39+
<td>{{build.Date}}</td>
4040
</tr>
4141
<tr>
4242
<th scope="row"><strong>Version</strong></th>
43-
<td>{{.Build.Version}}</td>
43+
<td>{{build.Version}}</td>
4444
</tr>
4545
</tbody>
4646
</table>

web/views/p/footer.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<footer class="container">
22
<small>Built with <a href="https://picocss.com">Pico</a>
3-
<a href="{{repoURL}}">Source code</a>
4-
<a href="{{repoURL}}/blob/master/LICENSE">License</a>
3+
<a href="{{build.RepoURL}}">Source code</a>
4+
<a href="{{build.LicenseURL}}">License</a>
55
</small>
66
</footer>

0 commit comments

Comments
 (0)