Building slim binaries. Removing arch from binary name (amd64 only). Adding automatic release draft.

This commit is contained in:
Alexey Skobkin 2019-10-09 02:13:55 +03:00
parent f509f20bcc
commit 3994941210
No known key found for this signature in database
GPG Key ID: 5D5CEF6F221278E7
1 changed files with 22 additions and 7 deletions

View File

@ -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