Skip to content

Commit 97b7af4

Browse files
committed
chore: release workflow
1 parent 3ab00a3 commit 97b7af4

File tree

2 files changed

+198
-0
lines changed

2 files changed

+198
-0
lines changed

.github/workflows/release.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- v*
7+
8+
jobs:
9+
10+
release:
11+
name: Release version
12+
runs-on: ubuntu-latest
13+
env:
14+
GO_VERSION: stable
15+
CGO_ENABLED: 0
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
21+
22+
- uses: actions/setup-go@v5
23+
with:
24+
go-version: ${{ env.GO_VERSION }}
25+
26+
- name: Docker Login
27+
env:
28+
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
29+
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
30+
run: echo "${DOCKER_PASSWORD}" | docker login --username "${DOCKER_USERNAME}" --password-stdin
31+
32+
- name: Set up QEMU
33+
uses: docker/setup-qemu-action@v3
34+
35+
- name: Set up Docker Buildx
36+
uses: docker/setup-buildx-action@v3
37+
38+
# https://goreleaser.com/ci/actions/
39+
- name: Run GoReleaser
40+
uses: goreleaser/goreleaser-action@v6
41+
with:
42+
version: latest
43+
args: release -p 1 --clean --timeout=10m
44+
env:
45+
GITHUB_TOKEN: ${{ secrets.GH_TOKEN_REPO }}

.goreleaser.yml

Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
version: 2
2+
project_name: distributarepo
3+
4+
builds:
5+
- binary: distributarepo
6+
env:
7+
- CGO_ENABLED=0
8+
flags:
9+
- -trimpath
10+
ldflags:
11+
- -s -w -X main.version={{.Version}}
12+
13+
goos:
14+
- windows
15+
- darwin
16+
- linux
17+
- freebsd
18+
- openbsd
19+
goarch:
20+
- amd64
21+
- arm
22+
- arm64
23+
goarm:
24+
- 7
25+
- 6
26+
- 5
27+
ignore:
28+
- goos: darwin
29+
goarch: 386
30+
- goos: openbsd
31+
goarch: arm
32+
33+
changelog:
34+
sort: asc
35+
filters:
36+
exclude:
37+
- '(?i)^chore:'
38+
39+
archives:
40+
- id: distributarepo
41+
name_template: '{{ .ProjectName }}_v{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}{{ if .Mips }}_{{ .Mips }}{{ end }}'
42+
format: tar.gz
43+
format_overrides:
44+
- goos: windows
45+
format: zip
46+
files:
47+
- LICENSE
48+
49+
brews:
50+
- repository:
51+
owner: ldez
52+
name: homebrew-tap
53+
commit_author:
54+
name: ldez
55+
56+
directory: Formula
57+
homepage: https://github.com/ldez/distributarepo
58+
description: Helper to get an overview of the forks of a GitHub repository
59+
test: |
60+
system "#{bin}/distributarepo -v"
61+
62+
scoops:
63+
- repository:
64+
owner: ldez
65+
name: scoop-bucket
66+
commit_author:
67+
name: ldez
68+
69+
homepage: https://github.com/ldez/distributarepo
70+
description: Helper to get an overview of the forks of a GitHub repository
71+
license: APACHE
72+
73+
docker_manifests:
74+
- name_template: 'ldez/distributarepo:{{ .Tag }}'
75+
image_templates:
76+
- 'ldez/distributarepo:{{ .Tag }}-amd64'
77+
- 'ldez/distributarepo:{{ .Tag }}-arm64'
78+
- 'ldez/distributarepo:{{ .Tag }}-armv7'
79+
- name_template: 'ldez/distributarepo:latest'
80+
image_templates:
81+
- 'ldez/distributarepo:{{ .Tag }}-amd64'
82+
- 'ldez/distributarepo:{{ .Tag }}-arm64'
83+
- 'ldez/distributarepo:{{ .Tag }}-armv7'
84+
- name_template: 'ldez/distributarepo:v{{ .Major }}.{{ .Minor }}'
85+
image_templates:
86+
- 'ldez/distributarepo:v{{ .Major }}.{{ .Minor }}-amd64'
87+
- 'ldez/distributarepo:v{{ .Major }}.{{ .Minor }}-arm64'
88+
- 'ldez/distributarepo:v{{ .Major }}.{{ .Minor }}-armv7'
89+
90+
dockers:
91+
- use: buildx
92+
goos: linux
93+
goarch: amd64
94+
dockerfile: buildx.Dockerfile
95+
image_templates:
96+
- 'ldez/distributarepo:latest-amd64'
97+
- 'ldez/distributarepo:{{ .Tag }}-amd64'
98+
- 'ldez/distributarepo:v{{ .Major }}.{{ .Minor }}-amd64'
99+
build_flag_templates:
100+
- '--pull'
101+
# https://github.com/opencontainers/image-spec/blob/main/annotations.md#pre-defined-annotation-keys
102+
- '--label=org.opencontainers.image.title={{.ProjectName}}'
103+
- '--label=org.opencontainers.image.description=Helper to get an overview of the forks of a GitHub repository'
104+
- '--label=org.opencontainers.image.source={{.GitURL}}'
105+
- '--label=org.opencontainers.image.url={{.GitURL}}'
106+
- '--label=org.opencontainers.image.documentation=https://github.com/ldez/distributarepo?tab=readme-ov-file'
107+
- '--label=org.opencontainers.image.created={{.Date}}'
108+
- '--label=org.opencontainers.image.revision={{.FullCommit}}'
109+
- '--label=org.opencontainers.image.version={{.Version}}'
110+
- '--platform=linux/amd64'
111+
112+
- use: buildx
113+
goos: linux
114+
goarch: arm64
115+
dockerfile: buildx.Dockerfile
116+
image_templates:
117+
- 'ldez/distributarepo:latest-arm64'
118+
- 'ldez/distributarepo:{{ .Tag }}-arm64'
119+
- 'ldez/distributarepo:v{{ .Major }}.{{ .Minor }}-arm64'
120+
build_flag_templates:
121+
- '--pull'
122+
# https://github.com/opencontainers/image-spec/blob/main/annotations.md#pre-defined-annotation-keys
123+
- '--label=org.opencontainers.image.title={{.ProjectName}}'
124+
- '--label=org.opencontainers.image.description=Helper to get an overview of the forks of a GitHub repository'
125+
- '--label=org.opencontainers.image.source={{.GitURL}}'
126+
- '--label=org.opencontainers.image.url={{.GitURL}}'
127+
- '--label=org.opencontainers.image.documentation=https://github.com/ldez/distributarepo?tab=readme-ov-file'
128+
- '--label=org.opencontainers.image.created={{.Date}}'
129+
- '--label=org.opencontainers.image.revision={{.FullCommit}}'
130+
- '--label=org.opencontainers.image.version={{.Version}}'
131+
- '--platform=linux/arm64'
132+
133+
- use: buildx
134+
goos: linux
135+
goarch: arm
136+
goarm: '7'
137+
dockerfile: buildx.Dockerfile
138+
image_templates:
139+
- 'ldez/distributarepo:latest-armv7'
140+
- 'ldez/distributarepo:{{ .Tag }}-armv7'
141+
- 'ldez/distributarepo:v{{ .Major }}.{{ .Minor }}-armv7'
142+
build_flag_templates:
143+
- '--pull'
144+
# https://github.com/opencontainers/image-spec/blob/main/annotations.md#pre-defined-annotation-keys
145+
- '--label=org.opencontainers.image.title={{.ProjectName}}'
146+
- '--label=org.opencontainers.image.description=Helper to get an overview of the forks of a GitHub repository'
147+
- '--label=org.opencontainers.image.source={{.GitURL}}'
148+
- '--label=org.opencontainers.image.url={{.GitURL}}'
149+
- '--label=org.opencontainers.image.documentation=https://github.com/ldez/distributarepo?tab=readme-ov-file'
150+
- '--label=org.opencontainers.image.created={{.Date}}'
151+
- '--label=org.opencontainers.image.revision={{.FullCommit}}'
152+
- '--label=org.opencontainers.image.version={{.Version}}'
153+
- '--platform=linux/arm/v7'

0 commit comments

Comments
 (0)