-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
73 lines (62 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
image:
name: floryn90/hugo:ext-asciidoctor
entrypoint: [""]
stages:
- build
- deploy
variables:
IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
DOCERK_DRIVER: overlay
GIT_SUBMODULE_STRATEGY: recursive
CI_BUILDS_DIR: /tmp/builds/
build:
stage: build
script:
- ls -l /
- mkdir -p /tmp/builds/resources /tmp/builds/alternative-public-dir
- HUGO_ENV=production hugo --noBuildLock --destination /tmp/builds/src/alternative-public-dir
artifacts:
paths:
- public
- resources
when: always
expire_in: 5 day
deploy:
stage: deploy
needs: ["build"]
only:
- no-masters
when: manual
# rules:
# - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
# when: always
# - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
# when: manual
variables:
GIT_CLEAN_FLAGS: none
before_script:
- apk --update add openssh-client rsync
- eval $(ssh-agent -s)
- echo "${deploykey}"| base64 -d| ssh-add - > /dev/null
- mkdir -p public; pwd
- echo 'tell me to trust the public keyprint'
- mkdir -p ~/.ssh/ && touch ~/.ssh/known_hosts && echo "$SSH_KNOWN_HOSTS" >> ~/.ssh/known_hosts
- chmod 700 ~/.ssh/known_hosts
script:
- echo "rsync it all"
- 'which rsync || ( apt-get -qq update && apt-get install -qq rsync )'
- echo "${deploykey}"| base64 -d| ssh-add - > /dev/null
- echo 'tell me to trust the public keyprint'
- mkdir -p ~/.ssh/ && touch ~/.ssh/known_hosts && echo "$SSH_KNOWN_HOSTS" >> ~/.ssh/known_hosts
- chmod 700 ~/.ssh
- ls -l public resources
#- ssh -v -t -o UserKnownHostsFile=~/.ssh/known_hosts web-hugo@204.13.164.51
- rsync -a -v --progress --human-readable
--exclude .git
--exclude .ssh
-e "ssh -o UserKnownHostsFile=~/.ssh/known_hosts -l web-hugo -o StrictHostKeyChecking=no"
public/ resources/
leap.se:/home/website/hugo/public
#leap.se:/tmp/testdeploy/
#-e "ssh -v -o UserKnownHostsFile=~/.ssh/known_hosts -l web-hugo -o StrictHostKeyChecking=no"
#"$PWD"