-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add goreleaser to make releases
Signed-off-by: Doug Goldstein <[email protected]>
- Loading branch information
Showing
4 changed files
with
81 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: release | ||
on: | ||
push: | ||
tags: | ||
- '*' | ||
|
||
permissions: | ||
contents: write | ||
id-token: write | ||
packages: write | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version-file: 'go.mod' | ||
cache: true | ||
- uses: docker/setup-buildx-action@v3 | ||
- uses: goreleaser/goreleaser-action@v4 | ||
with: | ||
distribution: goreleaser | ||
version: latest | ||
args: release --clean |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
project_name: cert-manager-webhook-rackspace | ||
|
||
builds: | ||
- main: ./cmd/webhook | ||
binary: cert-manager-webhook-rackspace | ||
env: | ||
- GCO_ENABLED=0 | ||
goos: | ||
- linux | ||
- windows | ||
- darwin | ||
ldflags: | ||
- -X 'main.Version={{.Version}}' | ||
- -X 'main.Gitsha={{.ShortCommit}}' | ||
|
||
dockers: | ||
- image_templates: | ||
- '{{ envOrDefault "REGISTRY" "ghcr.io" }}/{{ envOrDefault "REG_ORG" "rackerlabs" }}/{{ .ProjectName }}:{{ .Version }}' | ||
- '{{ envOrDefault "REGISTRY" "ghcr.io" }}/{{ envOrDefault "REG_ORG" "rackerlabs" }}/{{ .ProjectName }}:latest' | ||
use: buildx | ||
build_flag_templates: | ||
- "--label=org.opencontainers.image.description=Rackspace Cloud DNS support for cert-manager" | ||
- "--label=org.opencontainers.image.created={{.Date}}" | ||
- "--label=org.opencontainers.image.name={{.ProjectName}}" | ||
- "--label=org.opencontainers.image.revision={{.FullCommit}}" | ||
- "--label=org.opencontainers.image.version={{.Version}}" | ||
- "--label=org.opencontainers.image.source={{.GitURL}}" | ||
|
||
changelog: | ||
use: github | ||
sort: asc | ||
filters: | ||
exclude: | ||
- '^chore:' | ||
- '^docs:' | ||
- '^test:' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,5 @@ | ||
FROM golang:1.21-alpine3.18 AS build_deps | ||
FROM gcr.io/distroless/static-debian12:nonroot | ||
|
||
RUN apk add --no-cache git | ||
|
||
WORKDIR /workspace | ||
|
||
COPY go.mod . | ||
COPY go.sum . | ||
|
||
RUN go mod download | ||
|
||
FROM build_deps AS build | ||
|
||
COPY . . | ||
|
||
RUN CGO_ENABLED=0 go build -o webhook -ldflags '-w -extldflags "-static"' . | ||
|
||
FROM alpine:3.18 | ||
|
||
RUN apk add --no-cache ca-certificates | ||
|
||
COPY --from=build /workspace/webhook /usr/local/bin/webhook | ||
|
||
ENTRYPOINT ["webhook"] | ||
USER 20000:20000 | ||
COPY --chmod=555 cert-manager-webhook-rackspace /usr/local/bin/cert-manager-webhook-rackspace | ||
ENTRYPOINT ["/usr/local/bin/cert-manager-webhook-rackspace"] |