File tree Expand file tree Collapse file tree 8 files changed +991
-1
lines changed Expand file tree Collapse file tree 8 files changed +991
-1
lines changed Original file line number Diff line number Diff line change 1+ # Bump Version
2+
3+ A GitHub Action to bump a given version number.
4+
5+ ## Inputs
6+
7+ ``` yaml
8+ inputs :
9+ current-version :
10+ description : The current semantic version number.
11+ required : true
12+ release-type :
13+ description : Type of release. Must be one of `patch` | `minor` | `major`.
14+ required : true
15+ ` ` `
16+
17+ ## Outputs
18+
19+ ` ` ` yaml
20+ outputs :
21+ version :
22+ description : The new version number.
23+ ` ` `
24+
25+ ## Example Usage
26+
27+ ` ` ` yaml
28+ name : Bump Version
29+ on :
30+ workflow_dispatch :
31+ inputs :
32+ release_type :
33+ description : Type of release
34+ type : choice
35+ required : true
36+ options :
37+ - patch
38+ - minor
39+ - major
40+ jobs :
41+ release :
42+ runs-on : ubuntu-latest
43+ permissions :
44+ contents : write
45+ steps :
46+ - name : Git Checkout main
47+ uses : actions/checkout@v4
48+
49+ - name : Get latest release version
50+ id : get_current_version
51+ uses : actions/github-script@v7
52+ with :
53+ script : |
54+ const { data: { tag_name } } = await github.rest.repos.getLatestRelease({
55+ owner: context.repo.owner,
56+ repo: context.repo.repo
57+ })
58+ return tag_name
59+
60+ - name : Bump version
61+ id : bump
62+ uses : ./.github/actions/bump-version
63+ with :
64+ bump-type : ${{ inputs.release_type }}
65+ version : ${{ steps.get_current_version.outputs.result }}
66+
67+ - name : Push tag
68+ uses : actions/github-script@v7
69+ with :
70+ script : |
71+ github.rest.git.createRef({
72+ owner: context.repo.owner,
73+ repo: context.repo.repo,
74+ ref: 'refs/tags/${{ steps.bump.outputs.version }}',
75+ sha: context.sha
76+ })
77+ ` ` `
78+
79+ ## Acknowledgments
80+
81+ Uses [semver-tool](https://github.com/fsaintjacques/semver-tool)
Original file line number Diff line number Diff line change 1+ name : Bump Version
2+ description : Bumps a given version number.
3+
4+ inputs :
5+ current-version :
6+ description : The current semantic version number.
7+ required : true
8+ release-type :
9+ description : Type of release. Must be one of `patch` | `minor` | `major`.
10+ required : true
11+
12+ outputs :
13+ version :
14+ description : The new version number.
15+ value : ${{ steps.bump.outputs.new-version }}
16+
17+ runs :
18+ using : composite
19+ steps :
20+ - name : Bump Version
21+ id : bump
22+ shell : bash
23+ run : |
24+ echo "new-version=$( ${{ github.action_path }}/semver.sh bump ${{ inputs.release-type }} ${{ inputs.current-version }} )" >> $GITHUB_OUTPUT
You can’t perform that action at this time.
0 commit comments