forked from astronaut1712/gitlab-release-note-generator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.sample.gitlab-ci.yml
48 lines (46 loc) · 1.42 KB
/
.sample.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
stages:
- deploy
- post_deploy
tag-after-deployment:
only:
refs:
- master
- develop
variables:
- $CI_COMMIT_TITLE =~ /^[0-9]+.[0-9]+.[0-9]+(-[0-9]+)?$/
except:
refs:
- tags
stage: deploy
image: debian:stable
before_script:
- apt-get clean -qq
- apt-get update -qq --fix-missing
- apt-get install -qq --fix-missing jq git
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
- eval $(ssh-agent -s)
- echo "${SSH_PRIVATE_KEY}" | tr -d '\r' | ssh-add - > /dev/null
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- ssh-keyscan gitlab.com >> ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
- export VERSION=$(cat package.json | jq '.version' | sed "s/\"//g")
- git config --global user.name "${GITLAB_USER_NAME}"
- git config --global user.email "${GITLAB_USER_EMAIL}"
- git remote set-url origin "[email protected]:jackzhang/generator-test.git"
- git remote -v
script:
- git tag -a "v${VERSION}" ${CI_COMMIT_SHA} -m "${VERSION}"
- git push origin --tags
generate-release-note:
only:
refs:
- tags
variables:
- $CI_COMMIT_TITLE =~ /^[0-9]+.[0-9]+.[0-9]+(-[0-9]+)?$/
stage: post_deploy
image: docker:stable
services:
- docker:dind
script:
- docker container run -e GITLAB_PERSONAL_TOKEN=${GITLAB_ACCESS_TOKEN} -e GITLAB_PROJECT_ID=${CI_PROJECT_ID} 00freezy00/gitlab-release-note-generator