.gitlab-ci.yml 示例:stages:
- build
- test
- deploy
default:
image: node:20-alpine
cache:
key: "v1-$CI_COMMIT_REF_SLUG"
paths:
- node_modules/
- build/
policy: pull-push
variables:
NODE_ENV: production
build:
stage: build
script:
- npm ci
- npm run build
artifacts:
paths:
- build/
expire_in: 1 week
test:
stage: test
script:
- npm run test -- --ci
dependencies:
- build
deploy:
stage: deploy
rules:
- if: "$CI_COMMIT_BRANCH == 'main'"
script:
- echo Deploying
dependencies:
- build

发表评论 取消回复