Code Monkey home page Code Monkey logo

releaseter's Introduction

Releaseter

Go version License Release Code coverage Code quality Last commit

Releaseter is a GitHub Action that helps users generate release drafts from the latest release to the latest pull request. This tool is inspired by the configuration file of release-drafter/release-drafter.

Usage

To use Releaseter, simply add it as a step in your GitHub Action workflow:

name: example
on:
  workflow_dispatch:

jobs:
  test:
    runs-on: ubuntu-latest
    permissions:
      pull-requests: write
      contents: write
    steps:
      - uses: actions/checkout@v3
      - uses: JZGoopi/releaseter@v1
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}

When using Releaseter, make sure to pass in the github-token and grant it pull-requests and contents write permissions.

Customization

Releaseter can be customized by creating a configuration file. By default, Releaseter will look for a .github/releaseter.yml file for configuration. To specify a different file path, use the config-path input:

      - uses: JZGoopi/releaseter@v1
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}
          config-path: 'apple/banana.yml'

This will cause Releaseter to look for a configuration file at .github/apple/banana.yml.

Configuration File Template

The following is an example configuration file for Releaseter:

name-template: '{{ $TIME_WORKFLOW }}'

tag-template: 'v{{ $VERSION_NEXT_PATCH }}'
tag-preRelease: ""
tag-build: ""

categories:
  - title: '🚀 Features'
    labels:
      - 'feature'
      - 'feat'
  - title: '🐛 Bug Fixes'
    labels:
      - 'fix'
      - 'bugfix'
      - 'bug'

category-other:
  show: true
  title: 'OTHERRR'

category-except-labels:
  - wont_release
  - documentation

clear-history-draft: true

time-format: '06/01/02 15:04:05'
time-location: 'Asia/Taipei'

# If you want to use the except_releases option, the tag of each item is required.
except_releases:
  - tag: 'v1.0.1'           # require
    name: '230510 00:01:51' # option

except_keyword: '#jump'

name-template && tag-template

The name-template is the template for the release title. It supports several placeholders and defaults to {{ $TIME_WORKFLOW }}.

The tag-template is the template for the tag. It also supports several placeholders and defaults to v{{ $VERSION_NEXT_PATCH }}.

Both name-template and tag-template support the following placeholders:

  • {{ $VERSION_NEXT_MAJOR }}: the next major version
  • {{ $VERSION_NEXT_MINOR }}: the next minor version
  • {{ $VERSION_NEXT_PATCH }}: the next patch version
  • {{ $TIME_WORKFLOW }}: the time when the workflow is run
  • {{ $EMPTY }}: an empty string
  • The version numbers follow Semantic Versioning 2.0.0 as defined by GitHub, and Releaseter will use the latest tag that matches the tag-template as a baseline.

tag-preRelease && tag-build

tag-preRelease and tag-build are pre-release and build tags for Semantic Versioning 2.0.0, respectively. They default to an empty string.

categories

categories is an array of categories, each with a title and a list of labels. If a pull request's labels match any of the specified labels, its title will be added to the corresponding category. The format will be:

### Category Title
---
- PR1
- PR2

category-other

category-other controls whether to include pull requests that do not match any of the specified labels. It has two keys:

  • show: A boolean value that determines whether to include unmatched pull requests. The default value is false.
  • title: The title for the section that includes unmatched pull requests. The default value is 'OTHER'.

category-except-labels

category-except-labels Specifies an array of labels. Pull requests with any of these labels will be excluded from the release notes.

clear-history-draft

clear-history-draft controls whether to clear existing drafts. It defaults to false.

time-format

time-format is the format for the time. It uses Golang's placeholder syntax and defaults to '060102 15:04:05'. The available placeholders are:

  • Year:
    • 2006: four-digit year
    • 06: two-digit year
  • Month:
    • 1 or 01: numeric month
    • Jan: abbreviated month name
  • Day: 2 or 02
  • Hour:
    • 3: 12-hour clock hour
    • 15: 24-hour clock hour
  • Minute: 4 or 04
  • Second:
    • 5 or 05
    • 5.000000: decimal fraction of a second
  • Timezone:
    • MST: Mountain Standard Time
    • UTC: Coordinated Universal Time
    • EST: Eastern Standard Time
    • CST: Central Standard Time
    • PST: Pacific Standard Time
    • -0700: numeric timezone offset from UTC (e.g. -7 hours)
    • -07:00: numeric timezone offset from UTC with colon separator (e.g. -7:00)
  • Weekday:
    • Mon: abbreviated weekday name
    • Monday: full weekday name
  • AM/PM:
    • PM: uppercase AM/PM
    • pm: lowercase AM/PM

You can use these placeholders to format the time in the way that you prefer. For example, if you want to include the abbreviated weekday name and the timezone offset, you can use the following format:

time-format: 'Mon, Jan 02 2006 15:04:05 -0700'

This will produce a time string like Fri, May 07 2023 10:30:00 -0700, where Fri is the abbreviated weekday name, May 07 2023 is the date, 10:30:00 is the time, and -0700 is the timezone offset.

time-location

time-location Controls the timezone used for timestamps. The value must be a valid name from the IANA Time Zone database. The default value is 'Asia/Taipei'.

except_releases

Releaseter is a tool that captures all PR content from the time of the latest release to the current trigger of the Github action. However, sometimes for various reasons, a new release is manually written before the actual version is released, causing the Releaseter to refresh the time and miss some PRs. In this case, you can use except_releases to exclude those releases and obtain the actual latest release time point you want to capture.

You don't need to write this parameter for every release you want to exclude. You only need to write the ones you want to exclude from the latest release up until the desired release. Once Releaseter finds a release that is not excluded, it will recognize that release as the latest one you want to capture.

  • tag: The tag name bound to the release is a required parameter.
  • name: ,
    • Optional parameters.
    • The title of the release is provided as a parameter because there is a small possibility that two releases are bound to the same tag, but you only want to delete one of them. In this case, you can use the name parameter to more accurately find the release you want to delete.

except_keyword

The functionality of except_keyword is similar to except_releases. The difference is that except_keyword specifies a keyword, and when the title of a release contains that keyword, the release will be skipped. The process continues until a release that is not excluded is found, and that release is used as the reference time point.

Conclusion

Releaseter is a helpful tool for generating release drafts from the latest release to the latest pull request. With its customizable configuration options, you can tailor it to your specific needs.

Welcome Feedback

If you have any feedback or suggestions for Releaseter, please feel free to submit an issue on the GitHub repository. Your feedback helps us improve the tool for everyone!

License

Releaseter is licensed under the MIT License. Feel free to use, modify, and distribute this tool for any purpose.

releaseter's People

Watchers

Kostas Georgiou avatar JZ avatar

Forkers

backerfounder

releaseter's Issues

time-format 應該可以改成 array

安怎?

  • 有時候需要的格式不同,例如標題想要 06/01/02,而 tag 想要 v060102
  • placeholder 可以改成 {{ $TIME_WORKFLOW_INDEX }}

API 輪廓

name-template: '{{ $TIME_WORKFLOW_0 }}'
tag-template: 'v{{ $TIME_WORKFLOW_1 }}'

time-format: 
  - '06/01/02 15:04:05'
  - '060102'

寫一個 workflow ,在發新版本號時,更新 @v* tag

安怎?

因為每次更新版本號時都需要手動去更新通配符版,應該直接獲取版本好的 major,然後把那個 tag 自動拿去指向最新版本的 hash

API 輪廓

on:
  push:
    tags:
      - v*.*.*

jobs:
  build:
    - name: catch major tag
    - name: update major tag
        run: |
          git tag MAJOR_TAG ${{ steps.version.outputs.tag }} -f
          git push origin MAJOR_TAG -f

提供每個分類是否顯示的選項

安怎?

  • 有時候只是想分類而不想要讓該分類顯示
  • 可以避免分類進入其他類中

API 輪廓

categories:
  - title: '🚀 Features'
    labels:
      - 'feature'
      - 'feat'
    show: false

提供每個分類有 except 排除的選項

安怎?

  • 有時候雖然符合了某個分類,但是不希望他進到該分類中
  • 可以使用 pull 號碼來排除,又或者排除某個同時符合的 lable 名字也行
  • other 也需要

API 輪廓

# 個別排除
categories:
  - title: 'Features'
    labels:
      - 'feature'
      - 'feat'
    # 排除指定 pull
    except-pull:
      - 30
      - 20
    # 排除指定 lable
    except-lable:
      - wont_release

category-other:
  show: true
  title: 'OTHERRR'
  except-pull:
    - 30
    - 20
  except-lable:
    - wont_release

# 全局排除
category-except-lable:
  - wont_release
category-except-pull:
  - 99
  - 88

第一次發 Release 時,會找不到 tag 匹配而報錯

安怎?

如果沒發過 Release 時,使用這個 action 會直接炸裂

@版本號

1.0.0

最小重現連結

No response

重現步驟

  1. 開一個沒發過 Release 的項目
  2. 使用這個爛套件
  3. Boom!

預期結果

幫我寫好各種漂亮的 PR

實際結果

Screen Shot 2023-05-09 at 01 46 37

其他

No response

提供一個排除 release 的選項

安怎?

因為一些奇怪的因素,可能在發版之前就添加了一些 Release ,而且是在幾張 PR 被 merge 之後,那麼這幾張 PR 就會抓不到,因為規則是抓取最新 Release 的時間點之後到觸發當下的所有被 MERGE 的 RELEASE

API 輪廓

except_releases:
  - aabbccd
  - aabbcde
  - ...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.