diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 29d4173..759c7ea 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -18,31 +18,6 @@ jobs: - name: Lint the project uses: actions-contrib/golangci-lint@v1 - build: - name: Build - runs-on: ubuntu-18.04 - steps: - - - name: Set up Go 1.14 - uses: actions/setup-go@v1 - with: - go-version: 1.14 - id: go - - - name: Check out code into the Go module directory - uses: actions/checkout@v2 - - - name: Get dependencies - run: | - go get -v -t -d ./... - if [ -f Gopkg.toml ]; then - curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh - dep ensure - fi - - - name: Build - run: go build -v . - test: name: Test runs-on: ubuntu-18.04 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..4830cd7 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,36 @@ +name: goreleaser + +on: + push: + branches: [ master ] + tags: + - '*' + + +jobs: + goreleaser: + runs-on: ubuntu-latest + steps: + - + name: Checkout + uses: actions/checkout@v2 + + - + name: Unshallow + run: git fetch --prune --unshallow + + - + name: Set up Go + uses: actions/setup-go@v1 + with: + go-version: 1.14.x + + - + name: Run GoReleaser + uses: goreleaser/goreleaser-action@v1 + with: + version: latest + args: release --rm-dist + key: ${{ secrets.YOUR_PRIVATE_KEY }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 0000000..e241062 --- /dev/null +++ b/.goreleaser.yml @@ -0,0 +1,30 @@ +# This is an example goreleaser.yaml file with some sane defaults. +# Make sure to check the documentation at http://goreleaser.com +before: + hooks: + # You may remove this if you don't use go modules. + - go mod download +builds: +- env: + - CGO_ENABLED=0 +archives: +- replacements: + darwin: Darwin + linux: Linux + windows: Windows + 386: i386 + amd64: x86_64 +dockers: + - + image_templates: + - "us.gcr.io/larder-prod/kubewise:{{ .Tag }}" +checksum: + name_template: 'checksums.txt' +snapshot: + name_template: "{{ .Tag }}-next" +changelog: + sort: asc + filters: + exclude: + - '^docs:' + - '^test:' diff --git a/Dockerfile b/Dockerfile index 4044901..b6092ed 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,3 @@ -FROM golang:alpine AS build-env -WORKDIR /app -ADD . /app -RUN cd /app && env go build -o kubewise -FROM alpine -RUN apk update && \ - apk add ca-certificates && \ - update-ca-certificates && \ - rm -rf /var/cache/apk/* -WORKDIR /app -COPY --from=build-env /app/kubewise /app -ENTRYPOINT ./kubewise +FROM scratch +COPY kubewise / +ENTRYPOINT ["/kubewise"]