-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitlab-ci.yml
113 lines (102 loc) · 3.64 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# GitLab CI Configuration
# Copyright (C) 2020 Beezig Team
---
stages:
- build
- deploy
variables:
VERSION: '7.1.0'
image: gradle:latest
cache: &globalcache
key: "$CI_COMMIT_REF_SLUG"
paths:
- .gradle-home
policy: pull-push
build:
stage: build
script:
- git submodule update --init --remote --recursive
- ./gradlew build --gradle-user-home "$PWD/.gradle-home"
artifacts:
paths:
- build/libs/*.jar
expire_in: never
mirror:
allow_failure: true
image: alpine:latest
stage: deploy
interruptible: true
environment:
name: mirror
before_script:
- apk add openssh git bash coreutils
script:
- bash mirror.sh
cache:
<<: *globalcache
policy: pull
only:
refs:
- master
.deploy version:
image: alpine:latest
stage: deploy
interruptible: true
before_script:
- apk add openssh git jq bash coreutils
cache: {}
deploy beta version:
extends: .deploy version
environment:
name: beta-versioning
script:
- chmod go= "$DEPLOY_KEY"
- mkdir -p ~/.ssh/ || true
- ssh-keyscan -H 'gitlab.com' >> ~/.ssh/known_hosts
- ssh-agent bash -c "ssh-add \"$DEPLOY_KEY\"; git clone git@gitlab.com:Beezig/version.git ; version/update-version.sh --module beezig-laby --type beta --version $VERSION version/beta.json ; cd version; git add beta.json ; git -c 'user.name=GitLab Deploy' -c 'user.email=noreply@gitlab.com' commit -m 'Update beta version' ; git push origin master"
only:
refs:
- master
deploy release version:
extends: .deploy version
environment:
name: release-versioning
script:
- chmod go= "$DEPLOY_KEY"
- mkdir -p ~/.ssh/ || true
- ssh-keyscan -H 'gitlab.com' >> ~/.ssh/known_hosts
- ssh-agent bash -c "ssh-add \"$DEPLOY_KEY\"; git clone git@gitlab.com:Beezig/version.git ; version/update-version.sh --module beezig-laby --type release --version $VERSION version/release.json ; cd version; git add release.json ; git -c 'user.name=GitLab Deploy' -c 'user.email=noreply@gitlab.com' commit -m 'Update release version' ; git push origin master"
only:
- tags
.deployments:
image: alpine:latest
stage: deploy
interruptible: true
before_script:
- apk add openssh git
deploy beta:
extends: .deployments
environment:
name: beta
script:
- chmod go= "$DEPLOYMENTS_KEY"
- mkdir -p ~/.ssh/ || true
- ssh-keyscan -H 'gitlab.com' >> ~/.ssh/known_hosts
- "ssh-agent sh -c \"ssh-add \\\"$DEPLOYMENTS_KEY\\\" ; git clone git@gitlab.com:Beezig/deployments.git ; mkdir -p deployments/beeziglaby-beta || true ; cp build/libs/BeezigLaby*.jar \\\"deployments/beeziglaby-beta/BeezigLaby-$VERSION-$(git rev-list --count $(git describe --tags --abbrev=0)..HEAD)-$(git log -1 --format=%h).jar\\\" ; cd deployments ; git add . ; git -c 'user.name=GitLab Deploy' -c 'user.email=noreply@gitlab.com' commit -m 'deploy: Deploy BeezigLaby Beta' ; git push origin master\""
only:
- master
except:
- tags
deploy release:
extends: .deployments
environment:
name: release
script:
- chmod go= "$DEPLOYMENTS_KEY"
- mkdir -p ~/.ssh/ || true
- ssh-keyscan -H 'gitlab.com' >> ~/.ssh/known_hosts
- "ssh-agent sh -c \"ssh-add \\\"$DEPLOYMENTS_KEY\\\" ; git clone git@gitlab.com:Beezig/deployments.git ; mkdir -p deployments/beeziglaby-release || true ; cp build/libs/BeezigLaby*.jar deployments/beeziglaby-release/BeezigLaby-$VERSION.jar ; cd deployments ; git add . ; git -c 'user.name=GitLab Deploy' -c 'user.email=noreply@gitlab.com' commit -m 'deploy: Deploy BeezigLaby Release' ; git push origin master\""
when: manual
only:
- tags
...