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

View file

@ -1,31 +1,46 @@
image: "golang:1-alpine" image: "golang:1-alpine"
stages:
- build
- publish
before_script: before_script:
# Disabling cgo to not install gcc # Disabling cgo to not install gcc
- export CGO_ENABLED=0 - export CGO_ENABLED=0
- export GOARCH=amd64 - export GOARCH=amd64
build_linux_amd64: build_linux_amd64:
stage: build
script: script:
- export GOOS=linux - export GOOS=linux
- go build -o ./magnetico-go-migrator-$GOOS-$GOARCH . - go build -o ./magnetico-go-migrator-$GOOS "-ldflags=-s -w" .
- ./magnetico-go-migrator-$GOOS-$GOARCH --help - ./magnetico-go-migrator-$GOOS --help
artifacts: artifacts:
paths: paths:
- magnetico-go-migrator-*-* - magnetico-go-migrator-*
build_windows_amd64: build_windows_amd64:
stage: build
script: script:
- export GOOS=windows - export GOOS=windows
- go build -o ./magnetico-go-migrator-$GOOS-$GOARCH . - go build -o ./magnetico-go-migrator-$GOOS.exe "-ldflags=-s -w" .
artifacts: artifacts:
paths: paths:
- magnetico-go-migrator-*-* - magnetico-go-migrator-*.exe
build_darwin_amd64: build_darwin_amd64:
stage: build
script: script:
- export GOOS=darwin - export GOOS=darwin
- go build -o ./magnetico-go-migrator-$GOOS-$GOARCH . - go build -o ./magnetico-go-migrator-$GOOS "-ldflags=-s -w" .
artifacts: artifacts:
paths: 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