Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Shyp/bump_version
Go tool for bumping version numbers
https://github.com/Shyp/bump_version
Last synced: 14 days ago
JSON representation
Go tool for bumping version numbers
- Host: GitHub
- URL: https://github.com/Shyp/bump_version
- Owner: Shyp
- License: mit
- Created: 2016-02-10T04:34:08.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2022-12-15T15:07:03.000Z (almost 2 years ago)
- Last Synced: 2024-08-01T19:42:37.182Z (3 months ago)
- Language: Go
- Homepage: https://godoc.org/github.com/Shyp/bump_version
- Size: 14.6 KB
- Stars: 17
- Watchers: 14
- Forks: 7
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# bump_version
This is a tool for bumping version numbers in Go files.
## Installation
For the moment, you'll need a working Go installation.
```
go get github.com/Shyp/bump_version
```That will install the `bump_version` binary to your `$GOPATH`.
## Usage
```
bump_version
```This will:
1. Look for a `const` named `version`, `VERSION`, or `Version` in that file.
Here's an example:```go
package mainconst VERSION = "0.2.1"
```2. Apply the version bump - `bump_version major` will increment the major
version number, `bump_version minor` will increment the middle version number,
`bump_version patch` will increment the last version number. If your version is
"0.3" and you ask for `bump_version minor`, the new version will be "0.4".3. Write the new file to disk, with the bumped version.
4. Add the file with `git add `.
5. Add a commit with the message "x.y.z" (`git commit -m ""`)
6. Tag the new version.
If any of these steps fail, `bump_version` will abort.
## Notes
The VERSION should be a string in one of these formats: "3", "0.3",
"0.3.4". Any prefixes like "v" or suffixes like "0.3.3-beta" will be
stripped or generate an error.- `"v0.1"` - parse error, no prefixes allowed.
- `bump_version("0.1", "minor")` -> "0.2"
- `bump_version("0.1", "patch")` -> "0.1.1"
- `bump_version("0.1", "major")` -> "1.1"
- `bump_version("0.1-beta", "major")` -> "1.1"
- `bump_version("devel", "major")` -> parse error.We use the VERSION in code exclusively - any existing git tags are ignored.
Alan Shreve would like to note that you probably shouldn't store version
numbers in code - instead, check in `const VERSION = "devel"`, then build your
project via:```
go build -ldflags="-X main.VERSION=0.2"
```Which you are welcome to do!