Featured image of post CI/CD流水线配置

CI/CD流水线配置

GitLab CI/CD

使用GitLab CI/CD实现自动化构建和部署。

.gitlab-ci.yml示例

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
stages:
  - build
  - test
  - deploy

build:
  stage: build
  script:
    - npm install
    - npm run build

test:
  stage: test
  script:
    - npm test

deploy:
  stage: deploy
  script:
    - echo "Deploying to production..."
  only:
    - main

优势

  • 自动化测试
  • 持续集成
  • 快速部署