blog/.gitlab-ci.yml

50 lines
1.5 KiB
YAML
Raw Normal View History

image: node:alpine # Use latest version of Node.js on Alpine
2016-02-29 14:25:06 +00:00
cache: # add cache to 'node_modules' for speeding up builds
paths:
- node_modules/ # Node modules and dependencies
variables:
NODE_ENV: "production"
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
script:
2020-08-10 04:11:10 +00:00
- npm install snyk && npm run snyk # Refer to "scripts" in package.json
- npm run build # Generate site
artifacts:
paths:
- public # deploy from the 'public' folder.
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
renovate: # Check dependency update
before_script:
- apk update && apk add git
- npm install
script:
- npm install renovate
- npm run renovate
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