Skip to content
This repository was archived by the owner on Jan 26, 2023. It is now read-only.

Commit 6da4a08

Browse files
author
Amir Omidi
authored
Goreleaser (#3)
1 parent 5327a62 commit 6da4a08

4 files changed

Lines changed: 177 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: release
2+
3+
permissions:
4+
contents: write
5+
packages: write
6+
statuses: write
7+
pull-requests: read
8+
9+
on:
10+
push:
11+
tags:
12+
- v*
13+
14+
jobs:
15+
release:
16+
name: release
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- name: Set up Go
21+
uses: actions/setup-go@v1
22+
with:
23+
go-version: 1.17
24+
25+
- name: Checkout
26+
uses: actions/checkout@v2
27+
with:
28+
fetch-depth: 0
29+
30+
- name: Login to GitHub Container Registry
31+
uses: docker/login-action@v1
32+
with:
33+
registry: ghcr.io
34+
username: ${{ github.actor }}
35+
password: ${{ secrets.GITHUB_TOKEN }}
36+
37+
- name: Release and publish
38+
uses: goreleaser/goreleaser-action@v2
39+
with:
40+
version: latest
41+
args: release --rm-dist
42+
env:
43+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/test.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: test
2+
3+
permissions:
4+
contents: read
5+
statuses: write
6+
pull-requests: read
7+
8+
on:
9+
push:
10+
pull_request:
11+
workflow_dispatch:
12+
13+
jobs:
14+
test:
15+
name: test
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- name: Set up Go
20+
uses: actions/setup-go@v1
21+
with:
22+
go-version: 1.17
23+
24+
- name: Checkout
25+
uses: actions/checkout@v2
26+
with:
27+
fetch-depth: 0
28+
29+
- name: Test goreleaser
30+
uses: goreleaser/goreleaser-action@v2
31+
with:
32+
version: latest
33+
args: release --rm-dist --skip-publish

.goreleaser.yml

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
before:
2+
hooks:
3+
- go mod download
4+
5+
builds:
6+
- &build
7+
id: "attache-check-build"
8+
binary: "attache-check"
9+
env:
10+
- CGO_ENABLED=0
11+
goos:
12+
- linux
13+
- darwin
14+
- windows
15+
goarch:
16+
- amd64
17+
- arm64
18+
goarm:
19+
- "6"
20+
- "7"
21+
main: ./cmd/attache-check
22+
23+
- <<: *build
24+
id: "attache-control-build"
25+
binary: "attache-control"
26+
main: ./cmd/attache-control
27+
28+
archives:
29+
- replacements:
30+
darwin: Darwin
31+
linux: Linux
32+
windows: Windows
33+
"386": i386
34+
amd64: x86_64
35+
allow_different_binary_count: true
36+
37+
checksum:
38+
name_template: 'checksums.txt'
39+
40+
snapshot:
41+
name_template: "{{ .Tag }}-next"
42+
43+
changelog:
44+
sort: asc
45+
filters:
46+
exclude:
47+
- '^docs:'
48+
- '^test:'
49+
50+
dockers:
51+
- id: "attache-check-docker"
52+
ids:
53+
- "attache-check-build"
54+
image_templates:
55+
- "ghcr.io/letsencrypt/attache-check:{{ .Tag }}"
56+
- "ghcr.io/letsencrypt/attache-check:v{{ .Major }}"
57+
- "ghcr.io/letsencrypt/attache-check:v{{ .Major }}.{{ .Minor }}"
58+
- "ghcr.io/letsencrypt/attache-check:latest"
59+
build_flag_templates:
60+
- "--pull"
61+
- "--label=org.opencontainers.image.created={{.Date}}"
62+
- "--label=org.opencontainers.image.title=attache-check"
63+
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
64+
- "--label=org.opencontainers.image.version={{.Version}}"
65+
- "--build-arg=BINARY_NAME=attache-check"
66+
dockerfile: Dockerfile
67+
- id: "attache-control-docker"
68+
ids:
69+
- "attache-control-build"
70+
image_templates:
71+
- "ghcr.io/letsencrypt/attache-control:{{ .Tag }}"
72+
- "ghcr.io/letsencrypt/attache-control:v{{ .Major }}"
73+
- "ghcr.io/letsencrypt/attache-control:v{{ .Major }}.{{ .Minor }}"
74+
- "ghcr.io/letsencrypt/attache-control:latest"
75+
build_flag_templates:
76+
- "--pull"
77+
- "--label=org.opencontainers.image.created={{.Date}}"
78+
- "--label=org.opencontainers.image.title=attache-control"
79+
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
80+
- "--label=org.opencontainers.image.version={{.Version}}"
81+
- "--build-arg=BINARY_NAME=attache-control"
82+
dockerfile: Dockerfile
83+
84+
nfpms:
85+
- id: attache-nfpm
86+
package_name: attache
87+
builds:
88+
- attache-check-build
89+
- attache-control-build
90+
maintainer: Let's Encrypt <opensource@letsencrypt.org>
91+
description: A sidecar that allows for effortless scaling of Redis Clusters using Hashicorp Nomad and Consul.
92+
homepage: https://github.com/letsencrypt/attache
93+
formats:
94+
- deb
95+
- rpm
96+
- apk

Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
FROM scratch
2+
ARG BINARY_NAME
3+
4+
COPY ${BINARY_NAME} app
5+
ENTRYPOINT ["/app"]

0 commit comments

Comments
 (0)