iT邦幫忙

第 12 屆 iThome 鐵人賽

DAY 30
0
Modern Web

Go into Web!系列 第 30

Day30 | CI/CD 的導入 - 應用篇

終於到了最後一天了~今天就讓我們利用 Day26 所完成的專案搭配 giteadrone 來製作簡單的 CI 吧!

複製專案

各位可以先將 這個專案 clone 下來

git clone https://github.com/codingXiang/random_anonymous_chat

設定遠端的 repo

git remote add self http://<ip>:8888/chat/random_anonymous_chat.git

接著 commitpush 到自己架設的 gitea repository

git add .
git commit -m "init"
git push self master
kind: pipeline
type: docker
name: CI Process
steps:
  # develop 動作
  - name: 單元測試
    image: codingxiang/go_vc
    commands:
      - git config --global user.email "robot@example.com"
      - git config --global user.name "drone"
      - make deps
      - make test
    when:
      branch:
        - release
  # release 動作
  - name: 版本控制
    image: codingxiang/base_vc
    commands:
      - make branch=release vc
    when:
      status: [ success ]
      branch:
        - release
  - name: 打包與推送 Docker Image
    image: plugins/docker
    settings:
      username:
        from_secret: dockerUsername
      password:
        from_secret: dockerPassword
      repo: codingXiang
      registry: hub.docker.com
    when:
      status: [ success ]
      branch:
        - release
  - name: 上傳版本
    image: codingxiang/base_vc
    commands:
      - make branch=release add_git
    when:
      status: [ success ]
      branch:
        - release
  - name: 钉钉通知
    image: guoxudongdocker/drone-dingtalk
    settings:
      token:
        from_secret: dingTalkToken
      type: markdown
      message_color: true
      message_pic: true
      sha_link: true
    when:
      status: [failure, success]
trigger:
  branch:
    - release
  event:
    - push

上一篇
Day29 | CI/CD 的導入 - 設定篇
系列文
Go into Web!30
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言