-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from mgoltzsche/v2_goreleaser
Merge master into v2 to enable goreleaser for v2 branch
- Loading branch information
Showing
19 changed files
with
288 additions
and
286 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,58 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
# Publish `master` as Docker `latest` image. | ||
branches: | ||
- master | ||
- v2 | ||
- v1 | ||
|
||
# Publish `v1.2.3` tags as releases. | ||
tags: | ||
- v* | ||
|
||
jobs: | ||
push: | ||
runs-on: ubuntu-latest | ||
if: github.event_name == 'push' | ||
|
||
steps: | ||
- name: Set up Go | ||
uses: actions/setup-go@v1 | ||
with: | ||
go-version: 1.17 | ||
|
||
- name: Check out code into the Go module directory | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Set up qemu | ||
uses: docker/setup-qemu-action@v1 | ||
with: | ||
platforms: all | ||
|
||
- name: Extract Helm version | ||
id: extract_helm_version | ||
run: | | ||
printf '::set-output name=helm_version::' && | ||
grep helm\.sh/helm/ go.mod | sed -E -e 's!helm\.sh/helm/v3|\s+|\+.*!!g; s!^v!!' | cut -d " " -f2 | grep -E .+ | ||
- name: Build & Test | ||
run: make test check image e2e-test | ||
|
||
- name: Log into GitHub registry | ||
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin | ||
|
||
- name: Log into DockerHub registry | ||
run: echo "${{ secrets.DOCKERHUB_TOKEN }}" | docker login docker.io -u "${{ secrets.DOCKERHUB_USERNAME }}" --password-stdin | ||
|
||
- name: Run GoReleaser | ||
uses: goreleaser/goreleaser-action@v2 | ||
with: | ||
version: v0.182.1 | ||
args: release --rm-dist | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
HELM_VERSION: ${{ steps.extract_helm_version.outputs.helm_version }} |
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
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,21 @@ | ||
linters: | ||
enable: | ||
- gofmt | ||
- govet | ||
- errcheck | ||
- staticcheck | ||
- unused | ||
- gosimple | ||
- structcheck | ||
- varcheck | ||
- ineffassign | ||
- deadcode | ||
- typecheck | ||
- rowserrcheck | ||
- gosec | ||
- unconvert | ||
|
||
skip-dirs: | ||
- build | ||
- vendor | ||
|
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,90 @@ | ||
project_name: khelm | ||
dist: ./build/dist | ||
before: | ||
hooks: | ||
- go mod tidy | ||
builds: | ||
- main: ./cmd/khelm | ||
targets: | ||
- linux_amd64 | ||
- linux_arm64 | ||
- darwin_amd64 | ||
- darwin_arm64 | ||
env: | ||
- CGO_ENABLED=0 | ||
ldflags: | ||
- -s -w -extldflags '-static' -X main.khelmVersion={{.Version}} -X main.helmVersion={{.Env.HELM_VERSION}} | ||
checksum: | ||
name_template: 'checksums.txt' | ||
snapshot: | ||
name_template: '{{ incpatch .Version }}-dev-{{.ShortCommit}}' | ||
changelog: | ||
sort: asc | ||
filters: | ||
exclude: | ||
- '^docs(\([^)]+\))?:' | ||
- '^test(\([^)]+\))?:' | ||
- '^chore(\([^)]+\))?:' | ||
dockers: | ||
- id: khelm-amd64-image | ||
image_templates: | ||
- docker.io/mgoltzsche/khelm:{{.Version}}-amd64 | ||
- ghcr.io/mgoltzsche/khelm:{{.Version}}-amd64 | ||
use: buildx | ||
dockerfile: Dockerfile | ||
build_flag_templates: | ||
- "--pull" | ||
- "--label=org.opencontainers.image.created={{.Date}}" | ||
- "--label=org.opencontainers.image.title={{.ProjectName}}" | ||
- "--label=org.opencontainers.image.revision={{.FullCommit}}" | ||
- "--label=org.opencontainers.image.version={{.Version}}" | ||
- "--build-arg=KHELM_VERSION={{.Version}}" | ||
- "--build-arg=HELM_VERSION={{.Env.HELM_VERSION}}" | ||
- "--platform=linux/amd64" | ||
- id: khelm-arm64-image | ||
image_templates: | ||
- docker.io/mgoltzsche/khelm:{{.Version}}-arm64v8 | ||
- ghcr.io/mgoltzsche/khelm:{{.Version}}-arm64v8 | ||
use: buildx | ||
goarch: arm64 | ||
dockerfile: Dockerfile | ||
build_flag_templates: | ||
- "--pull" | ||
- "--label=org.opencontainers.image.created={{.Date}}" | ||
- "--label=org.opencontainers.image.title={{.ProjectName}}" | ||
- "--label=org.opencontainers.image.revision={{.FullCommit}}" | ||
- "--label=org.opencontainers.image.version={{.Version}}" | ||
- "--build-arg=KHELM_VERSION={{.Version}}" | ||
- "--build-arg=HELM_VERSION={{.Env.HELM_VERSION}}" | ||
- "--platform=linux/arm64/v8" | ||
docker_manifests: | ||
- id: khelm-multiarch-latest-dockerhub-image | ||
name_template: docker.io/mgoltzsche/khelm:latest | ||
image_templates: | ||
- docker.io/mgoltzsche/khelm:{{.Version}}-amd64 | ||
- docker.io/mgoltzsche/khelm:{{.Version}}-arm64v8 | ||
- id: khelm-multiarch-latest-ghcr-image | ||
name_template: ghcr.io/mgoltzsche/khelm:latest | ||
image_templates: | ||
- ghcr.io/mgoltzsche/khelm:{{.Version}}-amd64 | ||
- ghcr.io/mgoltzsche/khelm:{{.Version}}-arm64v8 | ||
- id: khelm-multiarch-major-dockerhub-image | ||
name_template: docker.io/mgoltzsche/khelm:{{.Major}} | ||
image_templates: | ||
- docker.io/mgoltzsche/khelm:{{.Version}}-amd64 | ||
- docker.io/mgoltzsche/khelm:{{.Version}}-arm64v8 | ||
- id: khelm-multiarch-major-ghcr-image | ||
name_template: ghcr.io/mgoltzsche/khelm:{{.Major}} | ||
image_templates: | ||
- ghcr.io/mgoltzsche/khelm:{{.Version}}-amd64 | ||
- ghcr.io/mgoltzsche/khelm:{{.Version}}-arm64v8 | ||
- id: khelm-multiarch-dockerhub-image | ||
name_template: docker.io/mgoltzsche/khelm:{{.Version}} | ||
image_templates: | ||
- docker.io/mgoltzsche/khelm:{{.Version}}-amd64 | ||
- docker.io/mgoltzsche/khelm:{{.Version}}-arm64v8 | ||
- id: khelm-multiarch-ghcr-image | ||
name_template: ghcr.io/mgoltzsche/khelm:{{.Version}} | ||
image_templates: | ||
- ghcr.io/mgoltzsche/khelm:{{.Version}}-amd64 | ||
- ghcr.io/mgoltzsche/khelm:{{.Version}}-arm64v8 |
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,19 +1,12 @@ | ||
FROM golang:1.14-alpine3.12 AS build | ||
RUN apk add --update --no-cache git | ||
ENV GO111MODULE=on CGO_ENABLED=0 | ||
COPY go.mod go.sum /go/src/github.com/mgoltzsche/khelm/ | ||
WORKDIR /go/src/github.com/mgoltzsche/khelm | ||
RUN go mod download | ||
COPY cmd/khelm /go/src/github.com/mgoltzsche/khelm/cmd/khelm | ||
COPY internal /go/src/github.com/mgoltzsche/khelm/internal | ||
COPY pkg /go/src/github.com/mgoltzsche/khelm/pkg | ||
ARG KHELM_VERSION=dev-build | ||
ARG HELM_VERSION=unknown-version | ||
RUN go build -o khelm -ldflags "-X main.khelmVersion=$KHELM_VERSION -X main.helmVersion=$HELM_VERSION -s -w -extldflags '-static'" ./cmd/khelm && mv khelm /usr/local/bin/ | ||
|
||
FROM alpine:3.12 | ||
FROM alpine:3.14 AS khelm | ||
RUN apk update --no-cache | ||
RUN mkdir /helm && chown root:nobody /helm && chmod 1777 /helm | ||
ENV HELM_REPOSITORY_CONFIG=/helm/repository/repositories.yaml | ||
ENV HELM_REPOSITORY_CACHE=/helm/cache | ||
COPY --from=build /usr/local/bin/khelm /usr/local/bin/khelmfn | ||
COPY khelm /usr/local/bin/khelmfn | ||
ENTRYPOINT ["/usr/local/bin/khelmfn"] | ||
|
||
FROM khelm AS test | ||
RUN khelmfn version | ||
|
||
FROM khelm |
Oops, something went wrong.