2020-05-16 05:50:41 +00:00
|
|
|
image: node:alpine # Use latest version of Node.js on Alpine
|
2016-02-29 14:25:06 +00:00
|
|
|
|
2018-10-28 08:16:18 +00:00
|
|
|
cache: # add cache to 'node_modules' for speeding up builds
|
|
|
|
paths:
|
|
|
|
- node_modules/ # Node modules and dependencies
|
|
|
|
|
2020-05-16 06:09:19 +00:00
|
|
|
variables:
|
|
|
|
NODE_ENV: "production"
|
|
|
|
|
2020-12-12 14:15:39 +00:00
|
|
|
## Rename to 'pages' for gitlab pages
|
2021-03-15 11:12:54 +00:00
|
|
|
build:
|
|
|
|
stage: build
|
2020-12-12 14:15:39 +00:00
|
|
|
|
2020-04-15 02:38:39 +00:00
|
|
|
before_script:
|
2021-03-15 11:12:54 +00:00
|
|
|
- apk update && apk add git
|
2020-08-10 04:11:10 +00:00
|
|
|
- npm install
|
2020-04-15 02:38:39 +00:00
|
|
|
|
2018-09-25 00:16:25 +00:00
|
|
|
script:
|
2020-12-12 08:13:30 +00:00
|
|
|
- npm run build # Generate site
|
2021-03-12 08:04:58 +00:00
|
|
|
|
2019-12-23 23:36:51 +00:00
|
|
|
rules:
|
2020-12-12 14:15:39 +00:00
|
|
|
# Only trigger through push & "Run pipeline" events in master branch; Skip in renovate job
|
|
|
|
- if: '$RENOVATE != "true" && $CI_COMMIT_REF_NAME == "master" && ($CI_PIPELINE_SOURCE == "push" || $CI_PIPELINE_SOURCE == "web")'
|
2019-12-23 23:36:51 +00:00
|
|
|
when: always
|
2018-11-06 08:37:35 +00:00
|
|
|
|
2021-03-15 22:47:39 +00:00
|
|
|
artifacts:
|
|
|
|
paths:
|
|
|
|
- public/
|
|
|
|
expire_in: 30 days
|
2020-12-12 09:06:16 +00:00
|
|
|
|
2021-03-15 11:12:54 +00:00
|
|
|
test:
|
|
|
|
stage: test
|
|
|
|
|
|
|
|
script:
|
|
|
|
- sh check-homepage.sh # Homepage should exists and non-empty
|
|
|
|
|
|
|
|
rules:
|
|
|
|
- if: '$RENOVATE != "true" && $CI_COMMIT_REF_NAME == "master" && ($CI_PIPELINE_SOURCE == "push" || $CI_PIPELINE_SOURCE == "web")'
|
|
|
|
when: always
|
|
|
|
|
2021-03-15 22:47:39 +00:00
|
|
|
artifacts:
|
|
|
|
paths:
|
|
|
|
- public/
|
|
|
|
expire_in: 30 days
|
|
|
|
|
2021-03-15 11:12:54 +00:00
|
|
|
deploy:
|
2020-12-12 14:15:39 +00:00
|
|
|
stage: deploy
|
2021-03-15 11:12:54 +00:00
|
|
|
|
|
|
|
before_script:
|
|
|
|
- apk update && apk add openssh-client rsync
|
|
|
|
- mkdir -p ~/.ssh
|
|
|
|
- chmod 700 ~/.ssh
|
|
|
|
- echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts
|
|
|
|
- chmod 644 ~/.ssh/known_hosts
|
|
|
|
- echo "$SSH_KEY_1" > ~/.ssh/id_host_1
|
|
|
|
- chmod 600 ~/.ssh/id_host_1
|
|
|
|
- echo "$SSH_KEY_2" > ~/.ssh/id_host_2
|
|
|
|
- chmod 600 ~/.ssh/id_host_2
|
|
|
|
- echo "$SSH_CONFIG" > ~/.ssh/config
|
|
|
|
- chmod 600 ~/.ssh/config
|
|
|
|
|
|
|
|
script:
|
|
|
|
- rsync -azvh --delete public/ host-1:/var/www/
|
|
|
|
- rsync -azvh --delete public/ host-2:/var/www/
|
|
|
|
|
2021-03-15 22:30:32 +00:00
|
|
|
rules:
|
|
|
|
- if: '$RENOVATE != "true" && $CI_COMMIT_REF_NAME == "master" && ($CI_PIPELINE_SOURCE == "push" || $CI_PIPELINE_SOURCE == "web")'
|
|
|
|
when: always
|
|
|
|
|
|
|
|
deploy_pages:
|
|
|
|
stage: deploy
|
|
|
|
|
2020-12-12 14:15:39 +00:00
|
|
|
trigger:
|
|
|
|
project: curben/curben.gitlab.io
|
|
|
|
branch: master
|
2020-12-12 14:17:28 +00:00
|
|
|
strategy: depend
|
2021-03-15 22:30:32 +00:00
|
|
|
|
2020-12-12 14:15:39 +00:00
|
|
|
rules:
|
|
|
|
- if: '$RENOVATE != "true" && $CI_COMMIT_REF_NAME == "master" && ($CI_PIPELINE_SOURCE == "push" || $CI_PIPELINE_SOURCE == "web")'
|
|
|
|
when: always
|
|
|
|
|
2018-10-28 08:16:18 +00:00
|
|
|
renovate: # Check dependency update
|
2020-05-15 10:34:26 +00:00
|
|
|
before_script:
|
2020-07-12 07:41:20 +00:00
|
|
|
- apk update && apk add git
|
2020-05-16 06:09:19 +00:00
|
|
|
- npm install
|
2020-05-15 10:34:26 +00:00
|
|
|
|
2018-10-28 08:16:18 +00:00
|
|
|
script:
|
2021-04-04 18:04:11 +00:00
|
|
|
- npm install snyk && npm run snyk
|
2020-05-16 06:09:19 +00:00
|
|
|
- npm install renovate
|
2018-10-28 07:28:45 +00:00
|
|
|
- npm run renovate
|
2018-09-29 06:03:51 +00:00
|
|
|
|
2021-03-15 22:47:39 +00:00
|
|
|
# No artifact
|
|
|
|
dependencies: []
|
|
|
|
|
2019-12-23 23:36:51 +00:00
|
|
|
rules:
|
2020-12-12 14:15:39 +00:00
|
|
|
- if: '$RENOVATE == "true" && $CI_COMMIT_REF_NAME == "master" && ($CI_PIPELINE_SOURCE == "schedule" || $CI_PIPELINE_SOURCE == "web")'
|
2019-12-23 23:36:51 +00:00
|
|
|
when: always
|