終於到了最後一天了~今天就讓我們利用 Day26 所完成的專案搭配 gitea 與 drone 來製作簡單的 CI 吧!
各位可以先將 這個專案 clone 下來
git clone https://github.com/codingXiang/random_anonymous_chat
設定遠端的 repo
git remote add self http://<ip>:8888/chat/random_anonymous_chat.git
接著 commit 與 push 到自己架設的 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