git 配置提交前端代码自动发布

git项目中的 .gitlab-ci.yml

#流水线的stages的顺序可以自己定义
#相同阶段的任务将会并发的执行,上一个阶段的任务完整的结束之后,下一个阶段的任务才会开始执行 
build-doc:
  stage: build
  tags:
    - md2doc
  script:
    - cd doc
    - convert.sh design.md design.pdf
  artifacts:
    paths:
      - doc/design.pdf

build:
  stage: build
  image: node:16.20.0
  tags:
    - nodejs
  cache:
    paths:
      - node_modules
  script:
    - export VERSION_NAME=$CI_COMMIT_REF_NAME
    - cd bamboo-web
    - npm --registry https://registry.npm.taobao.org install
    - npm --registry https://registry.npm.taobao.org run build
  artifacts:
    paths:
      - bamboo-web/dist

build-image-test-website-api:
  stage: deploy
  tags:
    - maven-gradle-docker-java8-247
  script:
    - cd test-website-api/
    - cp target/*.jar script
    - cd script
    - ls -l
    - cd ..
    - sudo docker login -u 'admin' -p YHyuPraN5C9ZCdu 172.xx.xx.xx:61234/test-website
    - sudo docker build  -t 172.xx.xx.xx:61234/test-website/test-website-api:1.0.0 --network=host script
    - sudo docker push 172.xx.xx.xx:61234/test-website/test-website-api:1.0.0
    - sshpass -p root ssh -o StrictHostKeyChecking=no [email protected] "sh /home/softwares/test-website-api/restart.sh test-website-api 172.xx.xx.xx:61234/test-website/test-website-api:1.0.0"

CI/CD => Pipelines 查看推送打包记录

git 配置提交前端代码自动发布_第1张图片

你可能感兴趣的:(其他,前端,git,vue.js)