blog/.gitlab-ci.yml

63 lines
1.4 KiB
YAML
Raw Permalink Normal View History

2024-09-28 06:31:52 +00:00
image: node:alpine # Use latest version of Node.js on Alpine
cache:
paths:
- node_modules/
variables:
NODE_ENV: "production"
# Rename to 'pages' for gitlab pages
build:
stage: build
before_script:
- apk update && apk add git
- npm install --include=optional --force
script:
# Generate site
- npm run build
rules:
# Only trigger through push & "Run pipeline" events not in "site" branch; Skip in renovate job
- if: '$RENOVATE != "true" && $CI_COMMIT_REF_NAME != "site" && ($CI_PIPELINE_SOURCE == "push" || $CI_PIPELINE_SOURCE == "web")'
when: always
artifacts:
paths:
- public/
expire_in: 30 days
test:
stage: test
script:
# /microblog/ should exist and non-empty
- sh check-homepage.sh
rules:
2024-09-28 22:34:00 +00:00
- if: '$RENOVATE != "true" && $CI_COMMIT_REF_NAME == "microblog" && ($CI_PIPELINE_SOURCE == "push" || $CI_PIPELINE_SOURCE == "web")'
2024-09-28 06:31:52 +00:00
when: always
artifacts:
paths:
- public/
expire_in: 30 days
deploy:
stage: deploy
before_script:
- apk update && apk add curl
script:
2024-10-07 01:39:49 +00:00
- curl -X POST --fail -F token=$CI_JOB_TOKEN -F ref=master ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/trigger/pipeline
2024-09-28 06:31:52 +00:00
rules:
- if: '$RENOVATE != "true" && $CI_COMMIT_REF_NAME == "microblog" && ($CI_PIPELINE_SOURCE == "push" || $CI_PIPELINE_SOURCE == "web")'
when: always
include:
- template: Security/Secret-Detection.gitlab-ci.yml