-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
75 lines (69 loc) · 2.03 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
stages:
- version
- build
- push
- release
- deploy
variables:
DOCKER_DRIVER: overlay2
DOCKER_TLS_CERTDIR: ""
.deployment: &deployment |
# Setup SSH deploy keys
which ssh-agent || ( apk add --no-cache openssh-client )
eval $(ssh-agent -s)
##
## Add the SSH key stored in SSH_PRIVATE_KEY variable to the agent store
## We're using tr to fix line endings which makes ed25519 keys work
## without extra base64 encoding.
## https://gitlab.com/gitlab-examples/ssh-private-key/issues/1#note_48526556
##
echo "${SSH_PRIVATE_KEY}" | tr -d '\r' | ssh-add - > /dev/null 2>&1
mkdir -p ~/.ssh
chmod 700 ~/.ssh
echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
ssh-keyscan -H ${DEPLOYMENT_TARGET} >> ~/.ssh/known_hosts
version:
stage: version
image: registry.gitlab.com/juhani/go-semrel-gitlab:v0.21.1
script:
- release test-git || true
- release test-api
- release next-version --allow-current
- release next-version --allow-current > .next-version
- echo "RELEASE_URL=https://gitlab.com/api/v4/projects/$CI_PROJECT_ID/jobs/$CI_JOB_ID/artifacts/release" > build_info
- echo "RELEASE_DESC=\"$(uname -mo) binary\"" >> build_info
- echo "RELEASE_SHA=$CI_COMMIT_SHA" >> build_info
- echo "RELEASE_VERSION=$(<.next-version)" >> build_info
artifacts:
paths:
- build_info
- .next-version
except:
- tags
only:
- master
# Release new Version
Release:
stage: release
image: registry.gitlab.com/juhani/go-semrel-gitlab:v0.21.1
script:
- rm -f release_info
- mv build_info release_info
- . release_info
- release -v
- release changelog
- release commit-and-tag CHANGELOG.md release_info
only:
- master
# Deploy:
# stage: deploy
# image: tiangolo/docker-with-compose
# script:
# - *deployment
# - DOCKER_HOST=ssh://${DEPLOYMENT_TARGET} docker-compose -f ci/docker-compose.yml up --remove-orphans -d
# allow_failure: false
# only:
# - master
# environment:
# name: production
# url: https://devops-projects.de