Bump version and publish release action
This action is bump version from latest release, publish release with changes note and push to version branch. Made it for the development of the action, but it can also be used for other purposes
Features:
# .github/workflows/release.yml:
name: Release
on:
workflow_dispatch:
inputs:
bump:
description: 'bump type, major or minor or patch or empty string'
default: ''
dry_run:
description: 'dry run, true or false'
default: 'false'
draft:
description: 'draft, true or false'
default: 'false'
pre_release:
description: 'pre release, true or false'
default: 'false'
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 20
- run: npm install
- run: npm run build
- run: npm run test
- uses: MeilCli/bump-release-action@v2
with:
config_path: '.github/bump.yml'
bump: ${{ github.event.inputs.bump }}
dry_run: ${{ github.event.inputs.dry_run }}
draft: ${{ github.event.inputs.draft }}
pre_release: ${{ github.event.inputs.pre_release }}
You can also pin to a specific release version in the format @v2.x.x
# .github/bump.yml
release:
title-prefix: 'v'
initial-version: '0.0.1'
tag-prefix: 'v'
commit-note-replacers:
- replace-prefix: 'breaking: '
new-prefix: ''
- replace-prefix: 'feature: '
new-prefix: ''
- replace-prefix: 'change: '
new-prefix: ''
- replace-prefix: 'fix: '
new-prefix: ''
- replace-prefix: 'document: '
new-prefix: ''
- replace-prefix: 'dependency: '
new-prefix: ''
branch:
version-branch-prefix: 'v'
bump-version-commit-prefix: 'v'
categories:
- title: 'Breaking Changes!'
labels:
- 'BreakingChange'
commits:
- 'breaking:'
changes-prefix: ':warning: '
- title: 'Changes'
labels:
- 'Feature'
commits:
- 'feature:'
changes-prefix: ':gift: '
- title: 'Changes'
labels:
- Maintenance
commits:
- 'change:'
changes-prefix: ':hammer: '
- title: 'Bug Fixes'
labels:
- 'Bug'
commits:
- 'fix:'
changes-prefix: ':ambulance: '
- title: 'Changes'
labels:
- 'Documentation'
commits:
- 'document:'
changes-prefix: ':blue_book: '
- title: 'Dependency Updates'
labels:
- 'Dependencies'
skip-label: 'Development'
commits:
- 'dependency:'
changes-prefix: ':green_book: '
bump:
default: 'patch'
major:
labels:
- 'BreakingChange'
commits:
- 'breaking:'
minor:
labels:
- 'Feature'
commits:
- 'feature:'
files:
- file-path: 'package.json'
line: 3
- file-path: 'package-lock.json'
line: 3
gitGraph:
commit id: "1"
commit id: "2"
branch pr
commit id: "3" type:reverse
commit id: "4" type:reverse
checkout main
merge pr id: "merge pull request" type:reverse tag:"label"
commit id: "5"
Pull request commit is excluded on commit calculating about release note and version.
repository
${{ github.repository }}
base_url
github.com
github_token
${{ github.token }}
commit_user
github-action
commit_email
41898282+github-actions[bot]@users.noreply.github.com
config_path
bump
major
or minor
or patch
or empty stringmajor
, minor
or patch
, priority execute to bump versiondry_run
true
, not create and push this changes, and output release informationsdraft
true
, create release as draftpre_release
true
, create release as pre releasecurrent_version
next_version
release
release:
title-prefix: 'v'
title-postfix: ' Released!'
body-title: 'Changed'
body-when-empty-changes: 'No changes'
initial-version: '0.0.1'
tag-prefix: 'v'
tag-postfix: '-stable'
sort-by: 'note'
sort-direction: 'ascending'
commit-note-replacers:
- replace-prefix: 'feature: '
new-prefix: 'feature '
pull-request-commit: 'exclude'
branch:
base-branch: 'develop'
version-branch-prefix: 'v'
version-branch-postfix: '-stable'
create-major-version-branch: false
create-minor-version-branch: true
bump-version-commit-prefix: 'v'
bump-version-commit-postfix: '-stable'
categories:
- title: 'Feature'
labels:
- 'feature'
skip-label: 'skip'
commits:
- 'feature:'
changes-prefix: '🎁'
changes-postfix: '😊'
bump:
default: 'minor'
major:
labels:
- 'major'
commits:
- 'major:'
minor:
labels:
- 'minor'
commits:
- 'minor:'
patch:
labels:
- 'patch'
commits:
- 'patch:'
files:
- file-path: 'version1.txt'
line: 1
start: 10
title-prefix
title-postfix
body-title
What's Changed
body-when-empty-changes
This release has not changes
initial-version
1.0.0
tag-prefix
tag-postfix
sort-by
note
or commit_at
commit_at
sort-direction
descending
or ascending
descending
commit-note-replacers
commit-note-replacers.replace-prefix
commit-note-replacers.new-prefix
pull-request-commit
exclude
: don't include PullRequest's commitinclude
: include PullRequest's commit(merge commit and branch commit)include_merge_commit_only
: include PullRequest's merge commitinclude_branch_commit_only
: include PullRequest's branch commitexclude
base-branch
master
version-branch-prefix
version-branch-postfix
create-major-version-branch
true
, create major version branch and push commit to ittrue
1.2.3
) => major version branch(${version-branch-prefix}1${version-branch-postfix}
)1.2.3
) and prefix v
=> major version branch(v1
)create-minor-version-branch
true
, create minor version branch and push commit to itfalse
1.2.3
) => minor version branch(${version-branch-prefix}1.2${version-branch-postfix}
)1.2.3
) and prefix v
=> minor version branch(v1.2
)bump-version-commit-prefix
files
configurationsbump-version-commit-postfix
files
configurationsThis configuration is array value, and Judgment is given priority in order from the top
title
Changes
labels
skip-label
commits
changes-prefix
changes-postfix
default
major
, minor
or patch
patch
major
major.labels
major.commits
minor
minor.labels
minor.commits
patch
patch.labels
patch.commits
This configuration is array value, if provide configuration, commit version up and push commit to base branch
file-path
line
start
Currently, cannot publish action to Marketplace using API. So, if you publish action to Marketplace, open release that published by this action, click edit release, and click update release button. If you are using a version branch, it is enough to do it only when the version branch changes or when the README is updated.
see Contributing.md