Skip to content

MetaMask/action-is-release

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

action-is-release

Description

Check whether the current commit is a release commit. Primarily this action looks at the .version key in a repository's package.json to see whether it has changed. Optionally, it can also validate that the commit message starts with a specific string.

image

Usage

Basic usage

This will look at the current commit, comparing it to github.event.before to see whether the version field of the package.json file in the root directory of the repository has changed. If the version has been updated, IS_RELEASE will be set to true. Otherwise, it will be set to false.

jobs:
  is-release:
    outputs:
      IS_RELEASE: ${{ steps.is-release.outputs.IS_RELEASE }}
    runs-on: ubuntu-latest
    steps:
      - uses: MetaMask/action-is-release@v2
        id: is-release

Filter by merge commit author

Here is an example of how to use this action with a merge author filter. This will act the same as the previous example, except that it will be skipped if the commit author is anyone other than "GitHub". When skipped, IS_RELEASE will be unset.

jobs:
  is-release:
    # Filter by commits made by the author "github-actions"
    if: github.event.head_commit.author.name == 'github-actions'
    outputs:
      IS_RELEASE: ${{ steps.is-release.outputs.IS_RELEASE }}
    runs-on: ubuntu-latest
    steps:
      - uses: MetaMask/action-is-release@v2
        id: is-release

With specific commit message prefix

Here is an example of how to use the commit-starts-with option.

jobs:
  is-release:
    outputs:
      IS_RELEASE: ${{ steps.is-release.outputs.IS_RELEASE }}
    runs-on: ubuntu-latest
    steps:
      - uses: MetaMask/action-is-release@v2
        id: is-release
        with:
          commit-starts-with: 'Release [version]'

This will set IS_RELEASE to true if triggered on a commit where the package version changed, and where the commit message starts with "Release [new package version]" (e.g "Release 1.0.0", if the package version was updated to "1.0.0").

This field can support multiple patterns separated by a comma. For example, if commit-starts-with is set to Release [version],Release/[version], it will match on both "Release 1.0.0" and "Release/1.0.0".

Conditionally running release jobs

You can then add filters in following jobs so those will skip if the IS_RELEASE criteria isn't met:

jobs:
  is-release:
    < insert example from above >
  publish-release:
    if: needs.is-release.outputs.IS_RELEASE == 'true'
    runs-on: ubuntu-latest
    needs: is-release

About

No description, website, or topics provided.

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages