提交 ca1423a5 authored 作者: 张伊明's avatar 张伊明

feat 更新ci配置

上级 36e079f6
流水线 #82 已失败
......@@ -3,9 +3,8 @@ stages:
- deploy
cache:
key:
files:
- package-lock.json
# cache:key 这里使用字符串,兼容性更好(部分 linter 不支持 key: { files: [...] })
key: "npm-cache-$CI_COMMIT_REF_SLUG"
paths:
- .npm/
policy: pull-push
......@@ -15,10 +14,8 @@ build_pre:
image: node:20-bullseye
tags:
- risk-monitor-frontend
rules:
- if: '$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == "pre"'
when: on_success
- when: never
only:
- pre
script:
- node -v
- npm -v
......@@ -34,13 +31,10 @@ deploy_pre:
image: alpine:3.20
tags:
- risk-monitor-frontend
rules:
- if: '$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == "pre"'
when: on_success
- when: never
needs:
- job: build_pre
artifacts: true
only:
- pre
dependencies:
- build_pre
# 避免多次 deploy 争抢同一份 nginx 目录(极端情况下仍可串行化兜底)
resource_group: pre-nginx-deploy
script:
......@@ -50,7 +44,7 @@ deploy_pre:
LATEST_PIPELINE_ID="$(
curl --silent --show-error --fail
--header "JOB-TOKEN: $CI_JOB_TOKEN"
"$CI_API_V4_URL/projects/$CI_PROJECT_ID/pipelines?ref=pre&order_by=id&sort=desc&per_page=1"
"$CI_SERVER_URL/api/v4/projects/$CI_PROJECT_ID/pipelines?ref=pre&order_by=id&sort=desc&per_page=1"
| jq -r '.[0].id'
)"
- >
......@@ -63,7 +57,7 @@ deploy_pre:
LATEST_PIPELINE_ID="$(
curl --silent --show-error --fail
--header "JOB-TOKEN: $CI_JOB_TOKEN"
"$CI_API_V4_URL/projects/$CI_PROJECT_ID/pipelines?ref=pre&order_by=id&sort=desc&per_page=1"
"$CI_SERVER_URL/api/v4/projects/$CI_PROJECT_ID/pipelines?ref=pre&order_by=id&sort=desc&per_page=1"
| jq -r '.[0].id'
)"
- >
......@@ -79,10 +73,10 @@ build_check:
image: node:20-bullseye
tags:
- risk-monitor-frontend
rules:
- if: '$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH && $CI_COMMIT_REF_PROTECTED != "true"'
when: on_success
- when: never
only:
- branches
except:
- protected_branches
script:
- node -v
- npm -v
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论