-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy path.gitlab-ci.yml
48 lines (42 loc) · 1.26 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
image: node:10
cache:
key: "gitlab-dashboard-yarn"
paths:
- node_modules
- .yarn-cache
stages:
- build
- publish
# "Build"
# The goal here is to just check for compile errors
build:
stage: build
script:
- yarn install --pure-lockfile --cache-folder .yarn-cache
# "Publish"
# We push the new version to the gh-pages branch
publish:
stage: publish
only:
- master
script:
# Build
## TODO: parametrize the js filename with the commit hash
- yarn install --pure-lockfile --cache-folder .yarn-cache
- echo "" > .nojekyll # Hack so we can include node_modules
# Configure git and ssh
- mkdir -p ~/.ssh
## Paste the PRIVATE key into a gitlab variable. Pay attention to the linebreak at the end when pasting
- echo "$GITHUB_PRIVATE_KEY" | tr -d '\r' > ~/.ssh/id_rsa
- chmod 600 ~/.ssh/id_rsa
- eval "$(ssh-agent -s)"
- ssh-add ~/.ssh/id_rsa
- ssh-keyscan -H 'github.com' >> ~/.ssh/known_hosts
- git config --global user.email "[email protected]"
- git config --global user.name "Gitlab CI"
# Deploy
- git checkout -b gh-pages
- git add -f node_modules app.js .nojekyll
- git commit -m "Generate gh-pages"
- git remote set-url origin [email protected]:KSF-Media/gitlab-dashboard.git
- git push -f --set-upstream origin gh-pages