-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
66 lines (59 loc) · 1.55 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
image: busybox
cache:
paths:
- node_modules/
stages:
- build
- build_img
- deploy
build_public:
image: node
stage: build
script:
- npm install hexo-cli -g
- npm install hexo-deployer-git --save
- npm install --save hexo-helper-live2d
- npm install live2d-widget-model-hibiki
- hexo generate
artifacts:
paths:
- public
expire_in: 2 days
variables: &VARIABLES
IMAGE_PER_BRANCH_COMMIT: $CI_REGISTRY/$CI_REGISTRY_REPOSITORY/$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME-$CI_COMMIT_SHORT_SHA
build_img:
image: docker
stage: build_img
needs:
- job: build_public
# only:
# - /^release\/.+$/
script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
- docker build -t "$IMAGE_PER_BRANCH_COMMIT" -f deploy/Dockerfile .
# - docker push "$IMAGE_PER_BRANCH_COMMIT"
deploy_public:
image: node
stage: deploy
only:
- pro
script:
- npm config set registry https://registry.npm.taobao.org
- npm install hexo-cli -g
- npm install hexo-deployer-git --save
- sed -i "s/TOKEN/${GITHUB_TOKEN}/g" _config.yml
- git config --global user.email "[email protected]"
- git config --global user.name "spring"
- hexo deploy
deploy_img:
image: bitnami/kubectl
stage: deploy
needs:
- job: build_img
only:
- master
script:
- sed -i "s|IMAGE_NAME|${IMAGE_PER_BRANCH_COMMIT}|g" deploy/blog-deployment.yaml
- kubectl apply -f deploy/blog-deployment.yaml
- kubectl apply -f deploy/blog-service.yaml
- kubectl apply -f deploy/blog-web.yaml