Update GoReleaser config

This commit is contained in:
David Stotijn
2022-01-25 13:20:16 +01:00
parent d84d2d0905
commit 1489cb16bf
6 changed files with 79 additions and 75 deletions

3
.gitignore vendored
View File

@ -1,7 +1,6 @@
/.release-env
/.vscode /.vscode
/dist /dist
/hetty /hetty
/cmd/hetty/admin /cmd/hetty/admin
*.pem *.pem
*.test *.test

View File

@ -1,60 +1,44 @@
env: before:
- GO111MODULE=on hooks:
- CGO_ENABLED=1 - make clean
- make build-admin
- go mod tidy
builds: builds:
- id: hetty-darwin-amd64 - env:
- CGO_ENABLED=0
main: ./cmd/hetty main: ./cmd/hetty
goarch: ldflags:
- amd64 - -s -w -X main.version=v{{.Version}}
goos:
- darwin
env:
- CC=o64-clang
- CXX=o64-clang++
flags:
- -mod=readonly
- id: hetty-linux-amd64
main: ./cmd/hetty
goarch:
- amd64
goos: goos:
- linux - linux
flags: - windows
- -mod=readonly - darwin
- id: hetty-windows-amd64
main: ./cmd/hetty
goarch: goarch:
- amd64 - amd64
goos: - arm64
- windows
env:
- CC=x86_64-w64-mingw32-gcc
- CXX=x86_64-w64-mingw32-g++
flags:
- -mod=readonly
ldflags:
- -buildmode=exe
archives: archives:
- - replacements:
replacements: darwin: macOS
darwin: macOS linux: Linux
linux: Linux windows: Windows
windows: Windows amd64: x86_64
386: i386
amd64: x86_64
format_overrides: format_overrides:
- goos: windows - goos: windows
format: zip format: zip
gomod:
proxy: true
env:
- GOPROXY=https://proxy.golang.org,direct
- GOSUMDB=sum.golang.org
checksum: checksum:
name_template: "checksums.txt" name_template: "checksums.txt"
snapshot: snapshot:
name_template: "{{ .Tag }}-next" name_template: "{{ incpatch .Version }}-next"
changelog: changelog:
sort: asc sort: asc

View File

@ -1,33 +1,21 @@
PACKAGE_NAME := github.com/dstotijn/hetty export CGO_ENABLED = 0
GOLANG_CROSS_VERSION ?= v1.16.3 export NEXT_TELEMETRY_DISABLED = 1
.PHONY: clean
clean:
rm -f hetty
rm -rf ./cmd/hetty/admin
rm -rf ./admin/node_modules
rm -rf ./admin/dist
rm -rf ./admin/.next
.PHONY: build-admin .PHONY: build-admin
build-admin: build-admin:
NEXT_TELEMETRY_DISABLED=1 cd admin && yarn install && yarn run export cd admin && \
yarn install --frozen-lockfile && \
yarn run export && \
mv dist ../cmd/hetty/admin
.PHONY: build .PHONY: build
build: build-admin build: build-admin
CGO_ENABLED=0 mv admin/dist cmd/hetty/admin && go build ./cmd/hetty go build ./cmd/hetty
.PHONY: release-dry-run
release-dry-run: build-admin
@docker run \
--rm \
-v `pwd`:/go/src/$(PACKAGE_NAME) \
-w /go/src/$(PACKAGE_NAME) \
troian/golang-cross:${GOLANG_CROSS_VERSION} \
--rm-dist --skip-validate --skip-publish
.PHONY: release
release: build-admin
@if [ ! -f ".release-env" ]; then \
echo "\033[91mFile \`.release-env\` is missing.\033[0m";\
exit 1;\
fi
@docker run \
--rm \
-v `pwd`:/go/src/$(PACKAGE_NAME) \
-w /go/src/$(PACKAGE_NAME) \
--env-file .release-env \
troian/golang-cross:${GOLANG_CROSS_VERSION} \
release --rm-dist

View File

@ -6,7 +6,7 @@
"dev": "next dev", "dev": "next dev",
"build": "next build", "build": "next build",
"start": "next start", "start": "next start",
"export": "rm -rf .next && next build && next export -o dist" "export": "next build && next export -o dist"
}, },
"dependencies": { "dependencies": {
"@apollo/client": "^3.2.0", "@apollo/client": "^3.2.0",

View File

@ -27,6 +27,9 @@ import (
"github.com/dstotijn/hetty/pkg/scope" "github.com/dstotijn/hetty/pkg/scope"
) )
var version = "v0.0.0"
// Flag variables.
var ( var (
caCertFile string caCertFile string
caKeyFile string caKeyFile string
@ -141,7 +144,7 @@ func run() error {
TLSNextProto: map[string]func(*http.Server, *tls.Conn, http.Handler){}, // Disable HTTP/2 TLSNextProto: map[string]func(*http.Server, *tls.Conn, http.Handler){}, // Disable HTTP/2
} }
log.Printf("[INFO] Running server on %v ...", addr) log.Printf("[INFO] Hetty (%v) is running on %v ...", version, addr)
err = s.ListenAndServe() err = s.ListenAndServe()
if err != nil && errors.Is(err, http.ErrServerClosed) { if err != nil && errors.Is(err, http.ErrServerClosed) {

34
go.mod
View File

@ -1,15 +1,45 @@
module github.com/dstotijn/hetty module github.com/dstotijn/hetty
go 1.16 go 1.17
require ( require (
github.com/99designs/gqlgen v0.14.0 github.com/99designs/gqlgen v0.14.0
github.com/dgraph-io/badger/v3 v3.2103.2 github.com/dgraph-io/badger/v3 v3.2103.2
github.com/google/go-cmp v0.5.6 github.com/google/go-cmp v0.5.6
github.com/gorilla/mux v1.7.4 github.com/gorilla/mux v1.7.4
github.com/hashicorp/golang-lru v0.5.1 // indirect
github.com/matryer/moq v0.0.0-20200106131100-75d0ddfc0007 github.com/matryer/moq v0.0.0-20200106131100-75d0ddfc0007
github.com/mitchellh/go-homedir v1.1.0 github.com/mitchellh/go-homedir v1.1.0
github.com/oklog/ulid v1.3.1 github.com/oklog/ulid v1.3.1
github.com/vektah/gqlparser/v2 v2.2.0 github.com/vektah/gqlparser/v2 v2.2.0
) )
require (
github.com/agnivade/levenshtein v1.1.0 // indirect
github.com/cespare/xxhash v1.1.0 // indirect
github.com/cespare/xxhash/v2 v2.1.1 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d // indirect
github.com/dgraph-io/ristretto v0.1.0 // indirect
github.com/dustin/go-humanize v1.0.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b // indirect
github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6 // indirect
github.com/golang/protobuf v1.3.1 // indirect
github.com/golang/snappy v0.0.3 // indirect
github.com/google/flatbuffers v1.12.1 // indirect
github.com/gorilla/websocket v1.4.2 // indirect
github.com/hashicorp/golang-lru v0.5.1 // indirect
github.com/klauspost/compress v1.12.3 // indirect
github.com/mitchellh/mapstructure v1.1.2 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/russross/blackfriday/v2 v2.0.1 // indirect
github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect
github.com/urfave/cli/v2 v2.1.1 // indirect
github.com/vektah/dataloaden v0.2.1-0.20190515034641-a19b9a6e7c9e // indirect
go.opencensus.io v0.22.5 // indirect
golang.org/x/mod v0.3.0 // indirect
golang.org/x/net v0.0.0-20201021035429-f5854403a974 // indirect
golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c // indirect
golang.org/x/tools v0.0.0-20210106214847-113979e3529a // indirect
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
gopkg.in/yaml.v2 v2.2.4 // indirect
)