Giter VIP home page Giter VIP logo

actions-gh-release's Introduction

actions-gh-release

An action that enables operating GitHub release via pull request. You send a pull request to update a RELEASE file then release note will be generated and commented in that pull request for reviewing. Once merged, a new GitHub release will be created with that release note.

Usage

  • Adding a RELEASE file to the repository. You can also have multiple RELEASE files in case of monorepo style. Its content looks like this:
tag: v0.1.0                        # The tag number will be created. Required.

# # Optional fields:
#
# name: string                     # The release name. Default is empty.
# title: string                    # The release title. Default is "Release ${tag}".
# targetCommitish: string          # The release commitish. Default is the merged commit.
# releaseNote: string              # The release body. Default is the auto-generated release note.
# prerelease: bool                 # True if this is a prerelease. Default is false.
#
#
# # If specified, all matching commits will be excluded from release. Empty means excluding nothing.
#
# commitExclude:
#   parentOfMergeCommit: bool      # True is whether the commit is the parent commit of the matching merge commit. Default is false.
#   prefixes: []string             # Matches if commit's subject is prefixed by one of the given values. Default is emtpy.
#   contains: []string             # Matches if commit's body is containing one of the given values. Default is emtpy.
#
#
# # If specified, all matching commits will be included to release. Empty means including alls.
#
# commitInclude:
#   parentOfMergeCommit: bool      # True is whether the commit is the parent commit of the matching merge commit. Default is false.
#   prefixes: []string             # Matches if commit's subject is prefixed by one of the given values. Default is emtpy.
#   contains: []string             # Matches if commit's body is containing one of the given values. Default is emtpy.
#
#
# # List of categories and how to decide which category a commit should belong to.
#
# commitCategories:
#   - title: string                # Category title.
#     parentOfMergeCommit: bool    # True is whether the commit is the parent commit of the matching merge commit. Default is false.
#     contains: []string           # Matches if commit's subject is prefixed by one of the given values. Default is emtpy.
#     prefixes: []string           # Matches if commit's body is containing one of the given values. Default is emtpy.
#
#
# # Config used while generating release note.
#
# releaseNoteGenerator:
#   showAbbrevHash: bool           # Whether to include abbreviated hash value in release note. Default is false.
#   showCommitter: bool            # Whether to include committer in release note. Default is true.
#   useReleaseNoteBlock: bool      # Whether to use release note block instead of commit message. Default is false.
#   usePullRequestMetadata: bool   # Whether to use pull request metadata instead of commit message when using merge-commit. If useReleaseNoteBlock is also true, release note block of pull request is used. Otherwise pull request title is used. If this option is set, showAbbrevHash and showCommitter is ignored. Default is false.
#   commitExclude:                 # Additional excludes applied while generating release note.
#     parentOfMergeCommit: bool    # True is whether the commit is the parent commit of the matching merge commit. Default is false.
#     prefixes: []string           # Matches if commit's subject is prefixed by one of the given values. Default is emtpy.
#     contains: []string           # Matches if commit's body is containing one of the given values. Default is emtpy.
#   commitInclude:                 # Additional includes applied while generating release note.
#     parentOfMergeCommit: bool    # True is whether the commit is the parent commit of the matching merge commit. Default is false.
#     prefixes: []string           # Matches if commit's subject is prefixed by one of the given values. Default is emtpy.
#     contains: []string           # Matches if commit's body is containing one of the given values. Default is emtpy.
  • Adding a new workflow (eg: .github/workflows/gh-release.yaml) with the content as below:
on:
  push:
    branches:    
      - main
    paths:
      - '**/RELEASE'
  pull_request:
    types: [opened, synchronize]
    branches:
      - main
    paths:
      - '**/RELEASE'

jobs:
  gh-release:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v1
      - uses: pipe-cd/[email protected]
        with:
          release_file: '**/RELEASE'
          token: ${{ secrets.GITHUB_TOKEN }}

Inputs

Name Description Required Default Value
token The GITHUB_TOKEN secret. yes
release_file The path to the RELEASE file or pattern to match one or multiple RELEASE files. no RELEASE
output_releases_file The path to output the list of releases formatted in JSON. no

Outputs

Name Description
releases The list of releases formatted in JSON.

RELEASE examples

  • Excluding merge pull request from release note
tag: v1.1.0

commitExclude:
  prefixes:
    - "Merge pull request #"
  • Grouping commits by category in release note
tag: v1.1.0

commitCategories:
  - title: "Breaking Changes"
    contains:
      - change-category/breaking-change
  - title: "New Features"
    contains:
      - change-category/new-feature
  - title: "Notable Changes"
    contains:
      - change-category/notable-change
  - title: "Internal Changes"

releaseNoteGenerator:
  showCommitter: true
  useReleaseNoteBlock: true
  • Multiple RELEASE files for mono-repo style
tag: foo-v0.1.0
name: foo

commitInclude:
  contains:
    - "application/foo"

releaseNoteGenerator:
  showAbbrevHash: true
  showCommitter: true
  useReleaseNoteBlock: true
  • Multiple RELEASE files for mono-repo style (Include parent commits of the matching merge commit in outoputs.release)
tag: bar-v1.0.0
name: bar

commitInclude:
  parentOfMergeCommit: true
  prefixes:
    - "bar:"

releaseNoteGenerator:
  showAbbrevHash: true
  showCommitter: true
  useReleaseNoteBlock: true
  commitInclude:
    prefixes:
      - "bar:"

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.