You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+25-12Lines changed: 25 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,15 +8,17 @@ This template can be used to calculate a release or pre-release version.
8
8
-[Pre-requisites](#pre-requisites)
9
9
-[Release vs Pre-release](#release-vs-pre-release)
10
10
-[Incrementing Strategy](#incrementing-strategy)
11
-
-[Creating a Ref](#creating-a-ref)
12
11
-[Inputs](#inputs)
13
12
-[Outputs](#outputs)
13
+
-[Breaking Changes](#breaking-changes)
14
+
-[v2 to v3](#v2-to-v3)
14
15
-[Usage Examples](#usage-examples)
15
16
-[Contributing](#contributing)
16
17
-[Incrementing the Version](#incrementing-the-version)
17
18
-[Source Code Changes](#source-code-changes)
18
19
-[Recompiling Manually](#recompiling-manually)
19
20
-[Updating the README.md](#updating-the-readmemd)
21
+
-[Tests](#tests)
20
22
-[Code of Conduct](#code-of-conduct)
21
23
-[License](#license)
22
24
@@ -55,10 +57,6 @@ The action will increment the minor version if it identifies any of the followin
55
57
56
58
If none of the previous patterns match, the action will increment the patch version.
57
59
58
-
## Creating a Ref
59
-
60
-
The action has a `create-ref` flag and when set to true it uses the GitHub rest API to [create a ref]. This API call results in a release and a tag being created. This may be desirable in some workflows where you are incrementing on merge but may not work well for others like a CI build where you want to hold off pushing the ref until some steps have completed.
61
-
62
60
## Inputs
63
61
64
62
| Parameter | Is Required | Default | Description |
@@ -67,8 +65,6 @@ The action has a `create-ref` flag and when set to true it uses the GitHub rest
67
65
|`fallback-to-no-prefix-search`| false |`true`| Flag indicating whether it should fallback to a prefix-less search if no tags are found with the current prefix. Helpful when starting to use prefixes with tags. Accepted values: true\|false. |
68
66
|`calculate-prerelease-version`| false |`false`| Flag indicating whether to calculate a pre-release version rather than a release version. Accepts: `true\|false`. |
69
67
|`branch-name`| Required when<br/>`calculate-prerelease-version: true`| N/A | The name of the branch the next pre-release version is being generated for. Required when calculating the pre-release version. |
70
-
|`create-ref`| false |`false`| Flag indicating whether the action should [create a ref] (a release and tag) on the repository. Accepted values: `true\|false`. |
71
-
|`github-token`| Required when<br/>`create-ref: true`| N/A | Token with permissions to create a ref on the repository. |
72
68
|`default-release-type`| false |`major`| The default release type that should be used when no tags are detected. Defaults to major. Accepted values: `major\|minor\|patch`. |
73
69
74
70
## Outputs
@@ -87,6 +83,19 @@ Each of the outputs are available as environment variables and as action outputs
87
83
|`PRIOR_VERSION`| The previous `major.minor.patch` version |
88
84
|`PRIOR_VERSION_NO_PREFIX`| The previous `major.minor.patch` version without the tag prefix |
89
85
86
+
## Breaking Changes
87
+
88
+
### v2 to v3
89
+
90
+
- The `create-ref` input was removed
91
+
- This input has been deprecated for a while. We recommend replacing this functionality with the `[im-open/create-release]` action.
92
+
- The `github-token` input was removed
93
+
- This was only needed to create a ref on the repository so it is no longer needed.
94
+
- The `NEXT_VERSION_SHA` output was removed
95
+
- Workflows can use the value that git-version-lite outputted directly.
96
+
- For `pull_request` workflow triggers the value was `github.event.pull_request.head.sha`.
97
+
- For all other workflow triggers the value was `github.sha`
98
+
90
99
## Usage Examples
91
100
92
101
```yml
@@ -107,16 +116,14 @@ jobs:
107
116
108
117
- id: get-version
109
118
# You may also reference just the major version.
110
-
uses: im-open/git-version-lite@v2.3.2
119
+
uses: im-open/git-version-lite@v3.0.0
111
120
with:
112
121
calculate-prerelease-version: true
113
122
branch-name: ${{ github.head_ref }} # github.head_ref works when the trigger is pull_request
114
123
tag-prefix: v # Prepend a v to any calculated release/pre-release version
115
124
fallback-to-no-prefix-search: true # Set to true can be helpful when starting to add tag prefixes
116
125
default-release-type: major # If no tags are found, default to doing a major increment
117
-
create-ref: true # Will create a release/tag on the repo
118
-
github-token: ${{ secrets.GITHUB_TOKEN }} # Required when creating a ref
119
-
126
+
120
127
- run: |
121
128
echo "The next version is ${{ env.NEXT_VERSION }}"
122
129
echo "The next version without the prefix is ${{ steps.get-version.outputs.NEXT_VERSION_NO_PREFIX }}"
@@ -131,6 +138,7 @@ When creating PRs, please review the following guidelines:
131
138
- [ ] At least one of the commit messages contains the appropriate `+semver:` keywords listed under [Incrementing the Version] for major and minor increments.
132
139
- [ ] The action has been recompiled. See [Recompiling Manually] for details.
133
140
- [ ] The README.md has been updated with the latest version of the action. See [Updating the README.md] for details.
141
+
- [ ] Any tests in the [build-and-review-pr] workflow are passing
134
142
135
143
### Incrementing the Version
136
144
@@ -165,6 +173,12 @@ npm run build
165
173
166
174
If changes are made to the action's [source code], the [usage examples] section of this file should be updated with the next version of the action. Each instance of this action should be updated. This helps users know what the latest tag is without having to navigate to the Tags page of the repository. See [Incrementing the Version] for details on how to determine what the next version will be or consult the first workflow run for the PR which will also calculate the next version.
167
175
176
+
### Tests
177
+
178
+
The [build-and-review-pr] workflow includes tests which are linked to a status check. That status check needs to succeed before a PR is merged to the default branch. When a PR comes from a branch, the workflow has access to secrets which are required to run the tests successfully.
179
+
180
+
When a PR comes from a fork, the workflow cannot access any secrets, so the tests won't have the necessary permissions to run. When a PR comes from a fork, the changes should be reviewed, then merged into an intermediate branch by repository owners so tests can be run against the PR changes. Once the tests have passed, changes can be merged into the default branch.
181
+
168
182
## Code of Conduct
169
183
170
184
This project has adopted the [im-open's Code of Conduct](https://github.com/im-open/.github/blob/main/CODE_OF_CONDUCT.md).
Copy file name to clipboardExpand all lines: action.yml
+4-17Lines changed: 4 additions & 17 deletions
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ description: An action to calculate the next tag for the repository based on com
5
5
inputs:
6
6
calculate-prerelease-version:
7
7
description: 'Flag indicating whether to calculate a pre-release version rather than a release version. Accepts: true|false.'
8
-
required: true
8
+
required: false
9
9
default: 'false'
10
10
11
11
branch-name:
@@ -14,28 +14,18 @@ inputs:
14
14
15
15
tag-prefix:
16
16
description: 'By default the action strips the prefixes off, but any value provided here will be prepended to the next calculated version.'
17
-
required: true
17
+
required: false
18
18
default: 'v'
19
19
20
20
fallback-to-no-prefix-search:
21
21
description: 'Flag indicating whether it should fallback to a prefix-less search if no tags are found with the current prefix. Helpful when starting to use prefixes with tags. Accepted values: true|false.'
22
-
required: true
22
+
required: false
23
23
default: 'true'
24
24
25
25
default-release-type:
26
26
description: 'The default release type that should be used when no tags are detected. Defaults to major. Accepted values: major|minor|patch'
27
-
required: true
28
-
default: 'major'
29
-
30
-
# Deprecated input. Instead create a release with the im-open/create-release action
31
-
create-ref:
32
-
description: 'Flag indicating whether the action should create a ref (a release and tag) on the repository. Accepted values: true|false'
33
-
required: true
34
-
default: 'false'
35
-
36
-
github-token:
37
-
description: Token with permissions to push a ref to the repository
38
27
required: false
28
+
default: 'major'
39
29
40
30
outputs:
41
31
NEXT_VERSION:
@@ -56,9 +46,6 @@ outputs:
56
46
NEXT_MAJOR_VERSION_NO_PREFIX:
57
47
description: 'The next major version without the tag prefix.'
58
48
59
-
NEXT_VERSION_SHA:
60
-
description: 'The SHA of the next version as an environment variable.'
61
-
62
49
PRIOR_VERSION:
63
50
description: 'The previous major.minor.patch version.'
0 commit comments