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

Commit

Permalink
Goreleaser (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
Amir Omidi authored Nov 23, 2021
1 parent 5327a62 commit 6da4a08
Show file tree
Hide file tree
Showing 4 changed files with 177 additions and 0 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: release

permissions:
contents: write
packages: write
statuses: write
pull-requests: read

on:
push:
tags:
- v*

jobs:
release:
name: release
runs-on: ubuntu-latest

steps:
- name: Set up Go
uses: actions/setup-go@v1
with:
go-version: 1.17

- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Release and publish
uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33 changes: 33 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: test

permissions:
contents: read
statuses: write
pull-requests: read

on:
push:
pull_request:
workflow_dispatch:

jobs:
test:
name: test
runs-on: ubuntu-latest

steps:
- name: Set up Go
uses: actions/setup-go@v1
with:
go-version: 1.17

- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Test goreleaser
uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: release --rm-dist --skip-publish
96 changes: 96 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
before:
hooks:
- go mod download

builds:
- &build
id: "attache-check-build"
binary: "attache-check"
env:
- CGO_ENABLED=0
goos:
- linux
- darwin
- windows
goarch:
- amd64
- arm64
goarm:
- "6"
- "7"
main: ./cmd/attache-check

- <<: *build
id: "attache-control-build"
binary: "attache-control"
main: ./cmd/attache-control

archives:
- replacements:
darwin: Darwin
linux: Linux
windows: Windows
"386": i386
amd64: x86_64
allow_different_binary_count: true

checksum:
name_template: 'checksums.txt'

snapshot:
name_template: "{{ .Tag }}-next"

changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'

dockers:
- id: "attache-check-docker"
ids:
- "attache-check-build"
image_templates:
- "ghcr.io/letsencrypt/attache-check:{{ .Tag }}"
- "ghcr.io/letsencrypt/attache-check:v{{ .Major }}"
- "ghcr.io/letsencrypt/attache-check:v{{ .Major }}.{{ .Minor }}"
- "ghcr.io/letsencrypt/attache-check:latest"
build_flag_templates:
- "--pull"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.title=attache-check"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"
- "--build-arg=BINARY_NAME=attache-check"
dockerfile: Dockerfile
- id: "attache-control-docker"
ids:
- "attache-control-build"
image_templates:
- "ghcr.io/letsencrypt/attache-control:{{ .Tag }}"
- "ghcr.io/letsencrypt/attache-control:v{{ .Major }}"
- "ghcr.io/letsencrypt/attache-control:v{{ .Major }}.{{ .Minor }}"
- "ghcr.io/letsencrypt/attache-control:latest"
build_flag_templates:
- "--pull"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.title=attache-control"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"
- "--build-arg=BINARY_NAME=attache-control"
dockerfile: Dockerfile

nfpms:
- id: attache-nfpm
package_name: attache
builds:
- attache-check-build
- attache-control-build
maintainer: Let's Encrypt <[email protected]>
description: A sidecar that allows for effortless scaling of Redis Clusters using Hashicorp Nomad and Consul.
homepage: https://github.com/letsencrypt/attache
formats:
- deb
- rpm
- apk
5 changes: 5 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM scratch
ARG BINARY_NAME

COPY ${BINARY_NAME} app
ENTRYPOINT ["/app"]

0 comments on commit 6da4a08

Please sign in to comment.