blog/.gitlab-ci.yml

40 lines
858 B
YAML
Raw Normal View History

# Use latest version of Node.js
image: node:latest
2016-02-29 14:25:06 +00:00
stages:
- build
- test
- deploy
cache: # add cache to 'node_modules' for speeding up builds
paths:
- node_modules/ # Node modules and dependencies
2016-02-29 14:25:06 +00:00
build-job:
stage: build
2016-02-29 14:25:06 +00:00
script:
- npm install -g hexo-cli snyk
- npm install
- snyk auth $SNYK_TOKEN
only:
- master # job will affect only the 'master' branch
snyk-test:
stage: test
script:
- snyk test # Test node modules for vulnerability
only:
- master
pages:
stage: deploy
script:
- snyk protect # Apply patches to node modules
- hexo deploy # deploy the site
- find public -type f -iregex '.*\.\(htm\|html\|txt\|text\|js\|css\)$' -execdir gzip -f --keep {} \; # Compress files
2016-02-29 14:25:06 +00:00
artifacts:
paths:
- public # deploy to the 'public' folder
only:
- master
when: on_success