From ec8b01b6f77b7005e49d231a36f2e1815c40b185 Mon Sep 17 00:00:00 2001 From: Pantelis Sampaziotis Date: Mon, 1 Mar 2021 23:52:05 +0100 Subject: [PATCH 1/2] add goreleaser --- .github/workflows/ci.yml | 39 +++++++++++---------------------------- .gitignore | 1 + .goreleaser.yml | 38 ++++++++++++++++++++++++++++++++++++++ CHANGELOG.md | 4 ++++ Dockerfile | 7 ++----- Makefile | 4 ++++ 6 files changed, 60 insertions(+), 33 deletions(-) create mode 100644 .goreleaser.yml create mode 100644 Makefile diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d8b1ed7..795344a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,67 +5,50 @@ jobs: build: strategy: matrix: - go-version: [1.13.x, 1.14.x] + go-version: [1.16.x] platform: [ubuntu-latest, macos-latest] name: build runs-on: ${{ matrix.platform }} steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 with: fetch-depth: 1 - - uses: actions/setup-go@v1 + - uses: actions/setup-go@v2 with: go-version: ${{ matrix.go-version }} - run: go build lint: strategy: matrix: - go-version: [1.13.x, 1.14.x] + go-version: [1.16.x] platform: [ubuntu-latest] name: lint runs-on: ${{ matrix.platform }} steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 with: fetch-depth: 1 - - uses: actions/setup-go@v1 + - uses: actions/setup-go@v2 with: go-version: ${{ matrix.go-version }} - - run: | - export PATH=$PATH:$(go env GOPATH)/bin # temporary fix. See https://github.com/actions/setup-go/issues/14 - go get -u golang.org/x/lint/golint + - run: | + go install golang.org/x/lint/golint@v0.0.0-20201208152925-83fdc39ff7b5 golint -set_exit_status ./... go vet ./... tests: strategy: matrix: - go-version: [1.13.x, 1.14.x] + go-version: [1.16.x] platform: [ubuntu-latest, macos-latest] name: tests runs-on: ${{ matrix.platform }} steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 with: fetch-depth: 1 - - uses: actions/setup-go@v1 + - uses: actions/setup-go@v2 with: go-version: ${{ matrix.go-version }} - run: | go get -u github.com/mfridman/tparse go test -v -race -cover -json ./... | $(go env GOPATH)/bin/tparse -all - docker: - strategy: - matrix: - go-version: [1.14.x] - platform: [ubuntu-latest] - name: docker - runs-on: ${{ matrix.platform }} - steps: - - uses: actions/checkout@v1 - with: - fetch-depth: 1 - - uses: actions/setup-go@v1 - with: - go-version: ${{ matrix.go-version }} - - run: | - docker build -t psampaz/gothanks . \ No newline at end of file diff --git a/.gitignore b/.gitignore index 91f1dca..9370f99 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ .idea +dist gothanks diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 0000000..0a814d7 --- /dev/null +++ b/.goreleaser.yml @@ -0,0 +1,38 @@ +# This is an example .goreleaser.yml 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: + - + ldflags: + -s -w + env: + - CGO_ENABLED=0 + goos: + - linux + - darwin +archives: + - replacements: + darwin: Darwin + linux: Linux + 386: i386 + amd64: x86_64 +checksum: + name_template: 'checksums.txt' +snapshot: + name_template: "{{ .Tag }}" +changelog: + sort: asc + filters: + exclude: + - '^docs:' + - '^test:' +dockers: + - + goos: linux + goarch: amd64 + image_templates: + - "psampaz/gothanks:latest" + - "psampaz/gothanks:{{ .Tag }}" diff --git a/CHANGELOG.md b/CHANGELOG.md index d7e3b65..d721f17 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +## [v0.4.0] - 2021-03-01 +### Added +- GoReleaser + ## [v0.3.0] - 2020-04-12 ### Added - Run gothanks using docker diff --git a/Dockerfile b/Dockerfile index b008991..e7f784e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,13 +1,10 @@ -FROM golang:1.14.2-alpine3.11 +FROM golang:1.16.0-alpine3.13 RUN apk update RUN apk add --no-cache git RUN apk --update add ca-certificates -WORKDIR /home -COPY ./ . -RUN CGO_ENABLED=0 GOOS=linux go build -ldflags "-s -w" -o gothanks . FROM scratch WORKDIR /home/ -COPY --from=0 /home/gothanks /usr/bin/ +COPY gothanks /usr/bin/ COPY --from=0 /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ ENTRYPOINT ["gothanks"] diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..97c6f3b --- /dev/null +++ b/Makefile @@ -0,0 +1,4 @@ +gorelease-dry: + goreleaser --snapshot --skip-publish --rm-dist +gorelease: + goreleaser From 4b68e78efa71ea0d5c0ece224946e850b48229aa Mon Sep 17 00:00:00 2001 From: Pantelis Sampaziotis Date: Tue, 2 Mar 2021 00:04:40 +0100 Subject: [PATCH 2/2] update makefile --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 97c6f3b..b9f67a0 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ gorelease-dry: goreleaser --snapshot --skip-publish --rm-dist gorelease: - goreleaser + goreleaser release