iT邦幫忙

2021 iThome 鐵人賽

DAY 5
0
自我挑戰組

冒險村-30 Day Ruby on Rails Tips Challenge系列 第 5

冒險村05 - Release Drafter

05 - Release Drafter

每當專案 merge & deploy 完畢時,都會產生對應的 releases log 紀錄 tag、修改的內容與打包的程式碼,就像 Create PR with default template 裡撰寫 Pull requests template 時相同,會有個 default 的 template 來幫我們產生文字敘述內容及產生日期的 tag。

除了能統一團隊對專案 releases log 撰寫模式外,也能省下撰寫的時間,

.github folder(與 app 資料夾同層)下再建立 workflows folder,並在該資料夾下建立 draft.yml file 撰寫內容。

Setting workflows > draft.yml

  name: Draft Release

  on:
    push:
      branches:
        - main

  jobs:
    update_release_draft:
      runs-on: ubuntu-latest
      steps:
        - uses: release-drafter/release-drafter@v5
          env:
            GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

這邊在建立當哪個 branch 有新的 commit 時,會觸發 github job 來產生 release-drafter action(以前的 repo branch 可能是 master,新的則為 main)

接下來在 .github folder 建立 release-drafter 的 template

Setting release-drafter.yml

  name-template: '$NEXT_MINOR_VERSION'
  tag-template: 'v$NEXT_MINOR_VERSION'
  categories:
    - title: '? Features'
      labels:
        - 'feature'
        - 'enhancement'
    - title: '? Bug Fixes'
      labels:
        - 'fix'
        - 'bugfix'
        - 'bug'
  change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
  template: |
    ## Changes
    $CHANGES

註: 以上 template 僅供參考,可以依照團隊決定最適合的方式來制訂 releases log 想要呈現的方式。

參考來源

My blog


上一篇
冒險村04 - Create PR with default template
下一篇
冒險村06 - Auto-update dependencies
系列文
冒險村-30 Day Ruby on Rails Tips Challenge30
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言