forked from DHowett/spectre
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
75 lines (65 loc) · 1.83 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
image: registry.howett.net/ghostbin/builder:master
stages:
- build
- deploy
.no-git-fetch: &no-git-fetch
variables:
GIT_STRATEGY: none
.dedicated-deploy-runner: &dedicated-deploy-runner
tags:
- ghostbin
- deploy
variables:
GO_PACKAGE: "howett.net/spectre"
before_script:
- "mkdir -p $(dirname $GOPATH/src/$GO_PACKAGE)/build"
- "ln -s $(pwd) $GOPATH/src/$GO_PACKAGE"
- "cd $GOPATH/src/$GO_PACKAGE"
legacy build:
stage: build
variables:
GO_PACKAGE: "github.com/DHowett/ghostbin"
GO111MODULE: "on"
only:
- v1-stable
script:
- npm install
- ./node_modules/grunt-cli/bin/grunt
- go build -ldflags="-w -s -X main.VERSION=${CI_COMMIT_REF_SLUG}.${CI_COMMIT_SHA}.${CI_JOB_ID}" -o build/ghostbin
- cp *.yml build/
- mkdir -p ./build/bin/pygments
- curl https://bitbucket.org/birkenfeld/pygments-main/get/stable.tar.bz2 | tar -x -j -C ./build/bin/pygments --strip-components=1
artifacts:
paths:
- build/
build:
stage: build
except:
- v1-stable
script:
- go get $GO_PACKAGE/cmd/spectred
- mkdir -p build/
- cp $GOPATH/bin/spectred build/
.deploy-common: &deploy-common
stage: deploy
when: manual
before_script:
- export DATE=$(date +%Y%m%d%H%M%S)
- export DESTDIR=/opt/ghostbin/$CI_COMMIT_REF_NAME
- mkdir -p $DESTDIR
script:
- mv build $DESTDIR/$DATE
- ln -Tsrf $DESTDIR/$DATE $DESTDIR/latest
after_script:
- sudo systemctl restart ghostbin@$CI_COMMIT_REF_NAME
production:
<<: *no-git-fetch
<<: *dedicated-deploy-runner
<<: *deploy-common
environment:
name: production
url: https://ghostbin.com
only:
- v1-stable
dependencies:
- "legacy build"