mirror of https://gitlab.com/curben/blog
34 lines
792 B
YAML
34 lines
792 B
YAML
# Use latest version of Node.js
|
|
image: node:latest
|
|
|
|
stages:
|
|
- test
|
|
- deploy
|
|
|
|
cache: # add cache to 'node_modules' for speeding up builds
|
|
paths:
|
|
- node_modules/ # Node modules and dependencies
|
|
|
|
snyk-test:
|
|
stage: test
|
|
script:
|
|
- npm install # install node modules
|
|
- npm install -g snyk
|
|
- snyk auth $SNYK_TOKEN
|
|
- snyk protect # Apply patches to node modules
|
|
- snyk test # Check node modules for vulnerability
|
|
only:
|
|
- master
|
|
|
|
pages:
|
|
stage: deploy
|
|
script:
|
|
- npm install -g hexo-cli
|
|
- hexo deploy # deploy the site
|
|
- find public -type f -iregex '.*\.\(htm\|html\|txt\|text\|js\|css\)$' -execdir gzip -f --keep {} \; # Compress files
|
|
artifacts:
|
|
paths:
|
|
- public # deploy to the 'public' folder
|
|
only:
|
|
- master
|
|
when: on_success |