-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitlab-ci.yml
88 lines (75 loc) · 2.53 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
image: golang:latest
stages:
- build
- deploy
.deploy-template: &deploy
stage: deploy
script:
# move binaries
- cp ./build/${BINARY} .
# import pgp
- gpg || true
- gpg --import ${PGP_PRIVATE}
- gpg --import ${PGP_PUBLIC}
- gpg --import-ownertrust ${PGP_TRUST}
# setup folder
- export SERIES=$(lsb_release -cs)
- export FOLDER=${FOLDER}-${SERIES}
- mkdir -p ${FOLDER}
- cp ${BINARY} ${FOLDER}/${BINARY}
- cd ${FOLDER}
# dh make
- env DEBEMAIL=${EMAIL} DEBFULLNAME=${AUTHOR} dh_make -p ${FOLDER} --createorig --indep --copyright mit -y
- rm debian/*ex debian/*.EX debian/README.*
# update control and changelog
- perl -i -pe "s/unstable/${SERIES}/" debian/changelog
- perl -i -pe 's/^(Section:).*/$1 $ENV{'SECTION'}/' debian/control
- perl -i -pe 's/^(Homepage:).*/$1 $ENV{'CI_PROJECT_URL'}/' debian/control
- perl -i -pe 's/^#(Vcs-Browser:).*/$1 $ENV{'CI_PROJECT_URL'}/' debian/control
- perl -i -pe 's/^#(Vcs-Git:).*/$1 $ENV{'CI_REPOSITORY_URL'}/' debian/control
- perl -i -pe 's/^(Description:).*/$1 $ENV{'DESC_SHORT'}/' debian/control
- perl -i -pe 's/^ <insert long description.*/ $ENV{'DESC_LONG'}/' debian/control
- perl -i -pe 's/^(Standards-Version:) 3.9.6/$1 3.9.7/' debian/control
- >
perl -i -0777 -pe "s/(Copyright: ).+\n +.+/\${1}$(date +%Y) $ENV{'AUTHOR'} <$ENV{'EMAIL'}>/" debian/copyright
- echo "${BINARY} usr/bin" > debian/install
# build package
- debuild -S
# publish
- cd ..
- dput ppa:${TARGET_PPA} $(ls | grep *.changes)
only:
- /^*.*$/
except:
- branches
variables:
AUTHOR: kirinnee
EMAIL: kirinnee97@gmail.com
BINARY: narwhal
BINARY_NAME: narwhal
FOLDER: ${BINARY_NAME}-${CI_COMMIT_TAG}
SECTION: utils
DESC_SHORT: Docker command line utility
DESC_LONG: Go-based CLI tha help withs common Docker actions, including saving and loading volumes
TARGET_PPA: kirinnee/main
Build:
stage: build
script:
- mkdir - p ./build
- env GOOS=windows GOARCH=amd64 go build -o ./build/${BINARY}.exe
- env CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" -a -installsuffix cgo -o ./build/${BINARY}
- chmod o+x ./build/${BINARY}
- env GOOS=darwin GOARCH=amd64 go build -o ./build/${BINARY}.app
artifacts:
paths:
- ./build/
expire_in: 90 days
Deploy 16.04:
<<: *deploy
image: kirinnee/ubuntu-packager:16.04
Deploy 18.04:
<<: *deploy
image: kirinnee/ubuntu-packager:18.04
Deploy 20.04:
<<: *deploy
image: kirinnee/ubuntu-packager:20.04