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 08:11:35 +00:00
|
|
|
pages:
|
2020-04-15 02:38:39 +00:00
|
|
|
before_script:
|
2020-07-12 07:56:14 +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-08-10 04:11:10 +00:00
|
|
|
- npm install snyk && npm run snyk # Refer to "scripts" in package.json
|
2020-12-12 08:13:30 +00:00
|
|
|
- npm run build # Generate site
|
2020-12-12 08:11:35 +00:00
|
|
|
|
|
|
|
artifacts:
|
|
|
|
paths:
|
|
|
|
- public # deploy from the 'public' folder.
|
2018-10-28 08:16:18 +00:00
|
|
|
|
2019-12-23 23:36:51 +00:00
|
|
|
rules:
|
|
|
|
# Skip in renovate job
|
|
|
|
- if: '$RENOVATE == "true"'
|
|
|
|
when: never
|
|
|
|
# Only trigger through push event in master branch
|
|
|
|
- if: '$CI_COMMIT_REF_NAME == "master" && $CI_PIPELINE_SOURCE == "push"'
|
|
|
|
when: always
|
|
|
|
# Only trigger through "Run pipeline" in master branch
|
|
|
|
- if: '$CI_COMMIT_REF_NAME == "master" && $CI_PIPELINE_SOURCE == "web"'
|
|
|
|
when: always
|
2018-11-06 08:37:35 +00:00
|
|
|
|
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:
|
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
|
|
|
|
2019-12-23 23:36:51 +00:00
|
|
|
rules:
|
|
|
|
# Only trigger when environment variable matches and through schedule in master branch
|
|
|
|
- if: '$RENOVATE == "true" && $CI_COMMIT_REF_NAME == "master" && $CI_PIPELINE_SOURCE == "schedule"'
|
|
|
|
when: always
|
|
|
|
# Only trigger when environment variable matches and through "Run pipeline" in master branch
|
|
|
|
- if: '$RENOVATE == "true" && $CI_COMMIT_REF_NAME == "master" && $CI_PIPELINE_SOURCE == "web"'
|
|
|
|
when: always
|