Skip to content

Commit 6c9dc4a

Browse files
committed
add goreleaser
1 parent 7b3911a commit 6c9dc4a

File tree

4 files changed

+84
-3
lines changed

4 files changed

+84
-3
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Create release
2+
on:
3+
pull_request_target:
4+
branches:
5+
- main
6+
types:
7+
- closed
8+
jobs:
9+
release:
10+
if: github.event.pull_request.merged == true && !contains(github.event.pull_request.title, 'skip-release')
11+
uses: libops/.github/.github/workflows/bump-release.yaml@main
12+
permissions:
13+
contents: write
14+
actions: write
15+
secrets: inherit

.github/workflows/goreleaser.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: goreleaser
2+
on:
3+
workflow_dispatch:
4+
push:
5+
tags:
6+
- "*"
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
goreleaser:
13+
runs-on: ubuntu-24.04
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
17+
with:
18+
fetch-depth: 0
19+
20+
- name: Set up Go
21+
uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6
22+
with:
23+
go-version: ">=1.25.6"
24+
25+
- name: Run GoReleaser
26+
uses: goreleaser/goreleaser-action@e435ccd777264be153ace6237001ef4d979d3a7a # v6
27+
with:
28+
distribution: goreleaser
29+
version: latest
30+
args: release --clean
31+
env:
32+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.goreleaser.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
before:
2+
hooks:
3+
- go mod tidy
4+
builds:
5+
- binary: vault-init
6+
env:
7+
- CGO_ENABLED=0
8+
goos:
9+
- linux
10+
- windows
11+
- darwin
12+
13+
archives:
14+
- format: tar.gz
15+
# this name template makes the OS and Arch compatible with the results of uname.
16+
name_template: >-
17+
{{ .ProjectName }}_
18+
{{- title .Os }}_
19+
{{- if eq .Arch "amd64" }}x86_64
20+
{{- else if eq .Arch "386" }}i386
21+
{{- else }}{{ .Arch }}{{ end }}
22+
{{- if .Arm }}v{{ .Arm }}{{ end }}
23+
# use zip for windows archives
24+
format_overrides:
25+
- goos: windows
26+
format: zip
27+
checksum:
28+
name_template: "checksums.txt"
29+
snapshot:
30+
name_template: "{{ incpatch .Version }}-next"
31+
changelog:
32+
sort: asc
33+
filters:
34+
exclude:
35+
- "^docs:"
36+
- "^test:"

Dockerfile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM golang:1.25.6 AS builder
1+
FROM golang:1.25.6@sha256:ce63a16e0f7063787ebb4eb28e72d477b00b4726f79874b3205a965ffd797ab2 AS builder
22

33
ENV GO111MODULE=on \
44
CGO_ENABLED=0 \
@@ -20,8 +20,6 @@ RUN go build \
2020
-o /bin/vault-init \
2121
.
2222

23-
RUN strip /bin/vault-init
24-
2523
FROM scratch
2624
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
2725
COPY --from=builder /bin/vault-init /bin/vault-init

0 commit comments

Comments
 (0)