Building slim binaries. Removing arch from binary name (amd64 only). Adding automatic release draft.
This commit is contained in:
parent
f509f20bcc
commit
3994941210
|
@ -1,31 +1,46 @@
|
|||
image: "golang:1-alpine"
|
||||
|
||||
stages:
|
||||
- build
|
||||
- publish
|
||||
|
||||
before_script:
|
||||
# Disabling cgo to not install gcc
|
||||
- export CGO_ENABLED=0
|
||||
- export GOARCH=amd64
|
||||
|
||||
build_linux_amd64:
|
||||
stage: build
|
||||
script:
|
||||
- export GOOS=linux
|
||||
- go build -o ./magnetico-go-migrator-$GOOS-$GOARCH .
|
||||
- ./magnetico-go-migrator-$GOOS-$GOARCH --help
|
||||
- go build -o ./magnetico-go-migrator-$GOOS "-ldflags=-s -w" .
|
||||
- ./magnetico-go-migrator-$GOOS --help
|
||||
artifacts:
|
||||
paths:
|
||||
- magnetico-go-migrator-*-*
|
||||
- magnetico-go-migrator-*
|
||||
|
||||
build_windows_amd64:
|
||||
stage: build
|
||||
script:
|
||||
- export GOOS=windows
|
||||
- go build -o ./magnetico-go-migrator-$GOOS-$GOARCH .
|
||||
- go build -o ./magnetico-go-migrator-$GOOS.exe "-ldflags=-s -w" .
|
||||
artifacts:
|
||||
paths:
|
||||
- magnetico-go-migrator-*-*
|
||||
- magnetico-go-migrator-*.exe
|
||||
|
||||
build_darwin_amd64:
|
||||
stage: build
|
||||
script:
|
||||
- export GOOS=darwin
|
||||
- go build -o ./magnetico-go-migrator-$GOOS-$GOARCH .
|
||||
- go build -o ./magnetico-go-migrator-$GOOS "-ldflags=-s -w" .
|
||||
artifacts:
|
||||
paths:
|
||||
- magnetico-go-migrator-*-*
|
||||
- magnetico-go-migrator-*
|
||||
|
||||
#publish:
|
||||
# image: inetprocess/gitlab-release
|
||||
# stage: publish
|
||||
# only:
|
||||
# - tags
|
||||
# script:
|
||||
# - gitlab-release --message 'New release' magnetico-go-migrator-linux-$CI_BUILD_TAG magnetico-go-migrator-windows-$CI_BUILD_TAG.exe magnetico-go-migrator-darwin-$CI_BUILD_TAG
|
Reference in a new issue