From 814a6f220ea955ce0d3c5526a8c7af02231be879 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=92=D0=BE=D1=80=D0=BE=D0=B1=D1=8C=D0=B5=D0=B2=20=D0=9F?=
=?UTF-8?q?=D0=B0=D0=B2=D0=B5=D0=BB?=
Date: Wed, 15 Apr 2020 15:20:28 +0300
Subject: [PATCH] Gitlab ci
---
.gitlab-ci.yml | 37 +++++++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
create mode 100644 .gitlab-ci.yml
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 0000000..07bc834
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,37 @@
+stages:
+ - build
+ - push
+
+image: golang:1.13
+
+.build:
+ stage: build
+ script:
+ - kname=`uname -s`
+ - kver=`uname -r`
+ - gitcommit=`git rev-list --tags --max-count=1`
+ - appver=`git describe --tags $gitcommit`
+ - appbuild=`git rev-list ${appver}.. --count`
+ - echo $appver-$appbuild > __ver__.txt
+ - importroot="github.com/viert/xc/cli"
+ - GOOS=${os} GOARCH=${arch} go build -o xc-${os}-${arch} -ldflags="-X $importroot.appVersion=$appver -X $importroot.appBuild=$appbuild -X $importroot.kernelName=$kname -X $importroot.kernelVersion=$kver -X $importroot.kernelArch=$arch" cmd/xc/main.go
+ artifacts:
+ name: binary
+ paths:
+ - xc-${os}-${arch}
+
+build:linux:
+ extends: .build
+ variables:
+ os: linux
+ arch: amd64
+
+push:
+ stage: push
+ script:
+ - filename=$(curl --upload-file ./xc-linux-amd64 https://t.bk.ru/xc)
+ - echo $filename > release.txt
+ artifacts:
+ name: release
+ paths:
+ - release.txt