blog/.gitlab-ci.yml

54 lines
1.5 KiB
YAML

image: node:alpine # Use latest version of Node.js on Alpine
cache: # add cache to 'node_modules' for speeding up builds
paths:
- node_modules/ # Node modules and dependencies
variables:
NODE_ENV: "production"
## Rename to 'pages' for gitlab pages
test:
stage: test
before_script:
- apk update && apk add git
- npm install
script:
- npm install snyk && npm run snyk # Refer to "scripts" in package.json
- npm run build # Generate site
rules:
# 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")'
when: always
## Uncomment below to enable gitlab pages
# artifacts:
# paths:
# - public # deploy from the 'public' folder.
deploy: # Trigger deploy job on curben/curben.gitlab.io
stage: deploy
trigger:
project: curben/curben.gitlab.io
branch: master
strategy: depend
rules:
- if: '$RENOVATE != "true" && $CI_COMMIT_REF_NAME == "master" && ($CI_PIPELINE_SOURCE == "push" || $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:
- if: '$RENOVATE == "true" && $CI_COMMIT_REF_NAME == "master" && ($CI_PIPELINE_SOURCE == "schedule" || $CI_PIPELINE_SOURCE == "web")'
when: always