-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
37 lines (34 loc) · 957 Bytes
/
.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
variables:
GIT_SUBMODULE_STRATEGY: recursive
SOURCE: $CI_PROJECT_DIR
BUILD_DESTINATION: $CI_PROJECT_DIR/public
GIT_PUSH_URL: https://$GITLAB_USER_LOGIN:$ACCESS_TOKEN@gitlab.com/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME.git
GIT_PUSH_BRANCH: master:pages
hugo_build:
image: registry.gitlab.com/pages/hugo/hugo_extended:latest
stage: build
only:
- master
script:
- hugo version
- hugo --source="$SOURCE" --destination="$BUILD_DESTINATION"
artifacts:
paths:
- public/
expire_in: 1 week
git_deploy:
image: alpine:latest
stage: deploy
only:
- master
when: on_success
before_script:
- apk add --no-cache git
script:
- cd $BUILD_DESTINATION
- git init
- git config user.name "$GITLAB_USER_NAME"
- git config user.email "$GITLAB_USER_EMAIL"
- git add --all
- git commit -m "Deploy $CI_COMMIT_SHA"
- git push --force --quiet $GIT_PUSH_URL $GIT_PUSH_BRANCH > /dev/null 2>&1