{"id":16892801,"url":"https://github.com/wader/bump","last_synced_at":"2025-04-09T15:05:46.560Z","repository":{"id":36669215,"uuid":"216878791","full_name":"wader/bump","owner":"wader","description":"A generic version tracking and update tool","archived":false,"fork":false,"pushed_at":"2025-04-02T16:33:50.000Z","size":365,"stargazers_count":70,"open_issues_count":2,"forks_count":7,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-09T15:05:42.639Z","etag":null,"topics":["bump","docker","git","github-action","semver","update","version","version-tracker"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wader.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-10-22T18:06:13.000Z","updated_at":"2025-04-08T03:23:38.000Z","dependencies_parsed_at":"2023-02-17T21:46:16.781Z","dependency_job_id":"7475bc25-3f60-46f3-bc2a-7c0455f692c5","html_url":"https://github.com/wader/bump","commit_stats":{"total_commits":254,"total_committers":3,"mean_commits":84.66666666666667,"dds":"0.49606299212598426","last_synced_commit":"d261c3003881d3c48595310cdb64de09bd29f429"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wader%2Fbump","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wader%2Fbump/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wader%2Fbump/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wader%2Fbump/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wader","download_url":"https://codeload.github.com/wader/bump/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248055284,"owners_count":21040157,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bump","docker","git","github-action","semver","update","version","version-tracker"],"created_at":"2024-10-13T17:12:27.468Z","updated_at":"2025-04-09T15:05:46.540Z","avatar_url":"https://github.com/wader.png","language":"Go","readme":"## Bump\n\nA generic version tracking and update tool.\n\nBump can be used to automate version updates where other version and package\nmanagement system does not fit or can't be used. This can be for example when\nhaving versions of dependencies in Makefile:s, Dockerfile:s, scripts or other\nkinds of texts.\n\nFor example this is a Bumpfile where we want to keep the Dockerfile base image\nversion updated to the latest exact alpine 3 version.\n\n```sh (exec)\n$ cat Bumpfile\n# Configuration for \"alpine\"\nalpine /FROM alpine:([\\d.]+)/ docker:alpine|^3\nalpine link \"Release notes\" https://alpinelinux.org/posts/Alpine-$LATEST-released.html\n# Look for matches in Dockerfile\nDockerfile\n# See current versions\n$ bump current\nDockerfile:1: alpine 3.9.2\n# See possible updates\n$ bump check\nalpine 3.21.0\n# See what will be changed\n$ bump diff\n--- Dockerfile\n+++ Dockerfile\n@@ -1,2 +1,2 @@\n-FROM alpine:3.9.2 AS builder\n+FROM alpine:3.21.0 AS builder\n \n# Write changes\n$ bump update\n```\n\nIt's also possible to have configuration embedded in source code comments etc and it's also possible to specify files to check instead of using a `Bumpfile`.\n\nA real world example is the\n[Dockerfile used by wader/static-ffmpeg](https://github.com/wader/static-ffmpeg/blob/master/Dockerfile)\nwhere important libraries are automatically kept up to date using the bump github action.\n\n## GitHub action\n\nBump can be used as a github action using the action `wader/bump/action@master`\nor by [providing it and referencing yourself](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/configuring-a-workflow#referencing-actions-in-your-workflow)\nHere is a workflow that will read `Bumpfile` and look for new versions and creates PRs once per day at 9 UTC:\n\n```yml\nname: 'Automatic version updates'\non:\n  schedule:\n    # minute hour dom month dow (UTC)\n    - cron: '0 9 * * *'\n  # enable manual trigger of version updates\n  workflow_dispatch:\njobs:\n  bump:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v4\n      - uses: wader/bump/action@master\n        env:\n          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n```\n\nSee [action.yml](action/action.yml) for input arguments.\n\nNote that if you want bump PRs to trigger other actions like CI builds\n[you currently have to use a personal access token](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/events-that-trigger-workflows#about-workflow-events)\nwith repo access and add it as a secret. For example\nadd a secret named `BUMP_TOKEN` and do `GITHUB_TOKEN: ${{ secrets.BUMP_TOKEN }}`.\n\nThese actions with different environments are available:  \n`wader/bump/action@master` alpine with git and curl  \n`wader/bump/action/go@master` alpine with git, curl and go  \n\n## Install\n\n### Docker\n\nImage from docker hub:\n```sh\ndocker run --rm -v \"$PWD:$PWD\" -w \"$PWD\" mwader/bump help\n```\nBuild image:\n```sh\ndocker build -t bump .\n```\n\n### Build\n\nInstall go and run command below and it will be installed at\n`$(go env GOPATH)/bin/bump`.\n\n```sh\ngo get github.com/wader/bump/cmd/bump\n```\n\n## Usage\n\n```sh (exec)\n$ bump help\nUsage: bump [OPTIONS] COMMAND\nOPTIONS:\n  -e                    Comma separated names to exclude\n  -f                    Bumpfile to read (Bumpfile)\n  -i                    Comma separated names to include\n  -r                    Run update commands (false)\n  -v                    Verbose (false)\n\nCOMMANDS:\n  version               Show version of bump itself (dev)\n  help [FILTER]         Show help or help for a filter\n  list [FILE...]        Show bump configurations\n  current [FILE...]     Show current versions\n  check [FILE...]       Check for possible version updates\n  update [FILE...]      Update versions\n  diff [FILE...]        Show diff of what an update would change\n  pipeline PIPELINE     Run a filter pipeline\n\nBUMPFILE is a file with CONFIG:s or glob patterns of FILE:s\nFILE is a file with EMBEDCONFIG:s or versions to be checked and updated\nEMBEDCONFIG is \"bump: CONFIG\"\nCONFIG is\n  NAME /REGEXP/ PIPELINE |\n  NAME command COMMAND |\n  NAME after COMMAND |\n  NAME message MESSAGE |\n  NAME link TITLE URL\nNAME is a configuration name\nREGEXP is a regexp with one submatch to find current version\nPIPELINE is a filter pipeline: FILTER|FILTER|...\nFILTER\n  git:\u003crepo\u003e | \u003crepo.git\u003e\n  gitrefs:\u003crepo\u003e\n  depsdev:\u003csystem\u003e:\u003cpackage\u003e\n  docker:\u003cimage\u003e\n  svn:\u003crepo\u003e\n  fetch:\u003curl\u003e | \u003chttp://\u003e | \u003chttps://\u003e\n  semver:\u003cconstraint\u003e | semver:\u003cn.n.n-pre+build\u003e | \u003cconstraint\u003e | \u003cn.n.n-pre+build\u003e\n  re:/\u003cregexp\u003e/ | re:/\u003cregexp\u003e/\u003ctemplate\u003e/ | /\u003cregexp\u003e/ | /\u003cregexp\u003e/\u003ctemplate\u003e/\n  sort\n  key:\u003cname\u003e | @\u003cname\u003e\n  static:\u003cname[:key=value:...]\u003e,...\n  err:\u003cerror\u003e\n```\n\n## Configuration\n\n`NAME` is a name of the configuration.\n\n`REGEXP` is a [golang regexp](https://golang.org/pkg/regexp/syntax/) with\none submatch/capture group to find the current version.\n\n`PIPELINE` is a pipeline of filters that describes how to find the latest\nsuitable version. The syntax is similar to pipes in a shell `filter|filter|...`\nwhere `filter` is either in the form `name:argument` like `re:/[\\d.]+/`,\n`semver:^4` or a shorter form like `/[\\d.]+/`, `^4` etc.\n\n### Bumpfile\n\nDefault `bump` looks for a file named `Bumpfile` in the current directory.\nEach line is a comment, configuration or a glob pattern of files to\nread embedded configuration from.\n\n```\n# comment\nNAME /REGEXP/ PIPELINE\nNAME [command|after] COMMAND\nNAME message MESSAGE\nNAME link TITLE URL\nfilename\nglob/*\n```\n\nExample Bumpfile:\n\n```\n# a bump configuration\nalpine /FROM alpine:([\\d.]+)/ docker:alpine|^3\nalpine message Make sure to also test with abc\nalpine link \"Release notes\" https://alpinelinux.org/posts/Alpine-$LATEST-released.html\n# read configuration, check and update version in Dockerfile\nDockerfile\n```\n\n### Embedded\n\nEmbedded configuration can be used to include bump configuration inside\nfiles containing versions to be checked or updated.\n\nEmbedded configuration looks like this:\n```\nbump: NAME /REGEXP/ PIPELINE\n```\n\nExample Dockerfile with embedded configuration:\n```\n# bump: alpine /FROM alpine:([\\d.]+)/ docker:alpine|^3\nFROM alpine:3.9.3 AS builder\n```\n\n### Run shell command on update\n\n```\nbump: NAME [command|after] COMMAND\n```\n`COMMAND` will run with these environment variables set:  \n`$NAME` is configuration name  \n`$CURRENT` is current version  \n`$LATEST` is latest version available  \n\nThere are two kinds of shell commands, `command` and `after`. `command` will be executed\ninstead bump doing the changes. `after` will always be executed after bump has done any changes.\nIf you have multiple commands they will be executed in the same order as they are configured.\n\nExample Bumpfile using `command` to run `go get` to change `go.mod` and `go.sum`:\n```\nmodule program\n\ngo 1.12\n\nrequire (\n  // bump: leaktest /github.com\\/fortytw2\\/leaktest v(.*)/ git:https://github.com/fortytw2/leaktest.git|^1\n  // bump: leaktest command go get -d github.com/fortytw2/leaktest@v$LATEST \u0026\u0026 go mod tidy\n  github.com/fortytw2/leaktest v1.2.0\n)\n```\n\nExample Bumpfile using `after` to run a script to update download hashes:\n```\nlibvorbis after ./hashupdate Dockerfile VORBIS $LATEST\n```\n\n### Commit and pull request messages and links\n\n```\nNAME message MESSAGE\nNAME link \"TITLE\" URL\n```\nThese variable are available in `MESSAGE`, `TITLE` and `URL`:  \n`$NAME` is configuration name  \n`$CURRENT` is current version  \n`$LATEST` is latest version available  \n\nYou can include messages and links in commit messages and pull requests by using one or\nmore `message` and `link` configurations.\n\nExample:\n```\nlibvorbis link \"CHANGES file\" https://github.com/xiph/vorbis/blob/master/CHANGES\nlibvorbis link \"Source diff $CURRENT..$LATEST\" https://github.com/xiph/vorbis/compare/v$CURRENT..v$LATEST\n```\n\n\n## Pipeline\n\nA pipeline consist of one or more filters executed in sequence. Usually\nit starts with a filter that produces versions from some source like a git repository.\nAfter that one or more filters can select, transform and sort versions to narrow it\ndown to one version. If a pipeline ends up producing more than one version the first\nwill be used.\n\nA version is a dictionary of key/value pairs, the \"name\" key is either the version number\nlike \"1.2.3\" or some symbolic name like \"master\". In addition a version can have other keys\nlike \"commit\", \"version\" etc depending on the source. You can use the key filter `key:\u003cname\u003e`\nor `@\u003cname\u003e` to use them.\n\nDefault all filters operate on the default key which is the \"name\". This can be changed\nalong a pipeline using `key:\u003cname\u003e` or `@\u003cname\u003e`.\n\n### Examples\n\nIn the examples `bump pipeline PIPELINE` is used to test run a pipeline and show\nthe result. Use `bump -v pipeline PIPELINE` for even more verbose output that\ncan be helpful when testing pipelines.\n\n```sh (exec)\n# Latest 4.0 ffmpeg version\n$ bump pipeline 'https://github.com/FFmpeg/FFmpeg.git|^4'\n4.4.5\n# Commit hash of the latest 4.0 ffmpeg version\n$ bump pipeline 'https://github.com/FFmpeg/FFmpeg.git|^4|@commit'\n9cf854a0c8827823df99e9924b84a2adb3dc98a5\n# Latest 1.0 golang docker build image\n$ bump pipeline 'docker:golang|^1'\n1.23.4\n# Latest mp3lame version\n$ bump pipeline 'svn:http://svn.code.sf.net/p/lame/svn|/^RELEASE__(.*)$/|/_/./|*'\n3.100\n```\n\n## Filters\n\nFilter are used to produce, transform and filter versions. Some filters like `git`\nproduces versions, `re` and `semver` transforms and filters.\n\n[filtersmarkdown]: sh-start\n\n[git](#filter-git) `git:\u003crepo\u003e` or `\u003crepo.git\u003e`\u003cbr\u003e\n[gitrefs](#filter-gitrefs) `gitrefs:\u003crepo\u003e`\u003cbr\u003e\n[depsdev](#filter-depsdev) `depsdev:\u003csystem\u003e:\u003cpackage\u003e`\u003cbr\u003e\n[docker](#filter-docker) `docker:\u003cimage\u003e`\u003cbr\u003e\n[svn](#filter-svn) `svn:\u003crepo\u003e`\u003cbr\u003e\n[fetch](#filter-fetch) `fetch:\u003curl\u003e`, `\u003chttp://\u003e` or `\u003chttps://\u003e`\u003cbr\u003e\n[semver](#filter-semver) `semver:\u003cconstraint\u003e`, `semver:\u003cn.n.n-pre+build\u003e`, `\u003cconstraint\u003e` or `\u003cn.n.n-pre+build\u003e`\u003cbr\u003e\n[re](#filter-re) `re:/\u003cregexp\u003e/`, `re:/\u003cregexp\u003e/\u003ctemplate\u003e/`, `/\u003cregexp\u003e/` or `/\u003cregexp\u003e/\u003ctemplate\u003e/`\u003cbr\u003e\n[sort](#filter-sort) `sort`\u003cbr\u003e\n[key](#filter-key) `key:\u003cname\u003e` or `@\u003cname\u003e`\u003cbr\u003e\n[static](#filter-static) `static:\u003cname[:key=value:...]\u003e,...`\u003cbr\u003e\n[err](#filter-err) `err:\u003cerror\u003e`\u003cbr\u003e\n### git\u003cspan id=\"filter-git\"\u003e\n\n`git:\u003crepo\u003e` or `\u003crepo.git\u003e`\n\nProduce versions from tags for a git repository. Name will be\nthe version found in the tag, commit the commit hash or tag object.\n\nUse gitrefs filter to get all refs unfiltered.\n\n```sh\n$ bump pipeline 'https://github.com/git/git.git|*'\n2.47.1\n```\n\n### gitrefs\u003cspan id=\"filter-gitrefs\"\u003e\n\n`gitrefs:\u003crepo\u003e`\n\nProduce versions from all refs for a git repository. Name will be the whole ref\nlike \"refs/tags/v2.7.3\" and commit will be the commit hash.\n\nUse git filter to get versions from only tags.\n\n```sh\n$ bump pipeline 'gitrefs:https://github.com/git/git.git'\nHEAD\n```\n\n### depsdev\u003cspan id=\"filter-depsdev\"\u003e\n\n`depsdev:\u003csystem\u003e:\u003cpackage\u003e`\n\nProduce versions from https://deps.dev.\n\nSupported package systems npm, go, maven, pypi and cargo.\n\n```sh\n$ bump pipeline 'depsdev:npm:react|*'\n19.0.0\n$ bump pipeline 'depsdev:go:golang.org/x/net'\n0.0.0-20150423015207-d175081df37e\n$ bump pipeline 'depsdev:maven:log4j:log4j|^1'\n1.2.17\n$ bump pipeline 'depsdev:pypi:av|*'\n14.0.1\n$ bump pipeline 'depsdev:cargo:serde|*'\n1.0.215\n```\n\n### docker\u003cspan id=\"filter-docker\"\u003e\n\n`docker:\u003cimage\u003e`\n\nProduce versions from a image on docker hub or other registry.\nCurrently only supports anonymous access.\n\n```sh\n$ bump pipeline 'docker:alpine|^3'\n3.21.0\n$ bump pipeline 'docker:mwader/static-ffmpeg|^4'\n4.4.1\n$ bump pipeline 'docker:ghcr.io/nginx-proxy/nginx-proxy|^0.9'\n0.9.3\n```\n\n### svn\u003cspan id=\"filter-svn\"\u003e\n\n`svn:\u003crepo\u003e`\n\nProduce versions from tags and branches from a subversion repository. Name will\nbe the tag or branch name, version the revision.\n\n```sh\n$ bump pipeline 'svn:https://svn.apache.org/repos/asf/subversion|*'\n1.14.5\n```\n\n### fetch\u003cspan id=\"filter-fetch\"\u003e\n\n`fetch:\u003curl\u003e`, `\u003chttp://\u003e` or `\u003chttps://\u003e`\n\nFetch a URL and produce one version with the content as the key \"name\".\n\n```sh\n$ bump pipeline 'fetch:http://libjpeg.sourceforge.net|/latest release is version (\\w+)/'\n6b\n```\n\n### semver\u003cspan id=\"filter-semver\"\u003e\n\n`semver:\u003cconstraint\u003e`, `semver:\u003cn.n.n-pre+build\u003e`, `\u003cconstraint\u003e` or `\u003cn.n.n-pre+build\u003e`\n\nUse [semver](https://semver.org/) to filter or transform versions.\n\nWhen a constraint is provided it will be used to find the latest version fulfilling\nthe constraint.\n\nWhen a version pattern is provided it will be used to transform a version.\n\n```sh\n# find latest major 1 version\n$ bump pipeline 'static:1.1.2,1.1.3,1.2.0|semver:^1'\n1.2.0\n# find latest minor 1.1 version\n$ bump pipeline 'static:1.1.2,1.1.3,1.2.0|~1.1'\n1.1.3\n# transform into just major.minor\n$ bump pipeline 'static:1.2.3|n.n'\n1.2\n```\n\n### re\u003cspan id=\"filter-re\"\u003e\n\n`re:/\u003cregexp\u003e/`, `re:/\u003cregexp\u003e/\u003ctemplate\u003e/`, `/\u003cregexp\u003e/` or `/\u003cregexp\u003e/\u003ctemplate\u003e/`\n\nAn alternative regex/template delimited can specified by changing the first\n/ into some other character, for example: re:#regexp#template#.\n\nFilter name using a [golang regexp](https://golang.org/pkg/regexp/syntax/).\nIf name does not match regexp the version will be skipped.\n\nIf only a regexp and no template is provided and no submatches are defined the\nname will not be changed.\n\nIf submatches are defined a submatch named \"name\" or \"value\" will be used as\nname and value otherwise first submatch will be used as name.\n\nIf a template is defined and no submatches was defined it will be used as a\nreplacement string. If submatches are defined it will be used as a template\nto expand $0, ${1}, $name etc.\n\nA regexp can match many times. Use ^$ anchors or (?m:) to match just one time\nor per line.\n\n```sh\n# just filter\n$ bump pipeline 'static:a,b|/b/'\nb\n# simple replace\n$ bump pipeline 'static:aaa|re:/a/b/'\nbbb\n# simple replace with # as delimiter\n$ bump pipeline 'static:aaa|re:#a#b#'\nbbb\n# name as first submatch\n$ bump pipeline 'static:ab|re:/a(.)/'\nb\n# multiple submatch replace\n$ bump pipeline 'static:ab:1|/(.)(.)/${0}$2$1/'\nabba\n# named submatch as name and value\n$ bump pipeline 'static:ab|re:/(?P\u003cname\u003e.)(?P\u003cvalue\u003e.)/'\na\n$ bump pipeline 'static:ab|re:/(?P\u003cname\u003e.)(?P\u003cvalue\u003e.)/|@value'\nb\n```\n\n### sort\u003cspan id=\"filter-sort\"\u003e\n\n`sort`\n\nSort versions reverse alphabetically.\n\n```sh\n$ bump pipeline 'static:a,b,c|sort'\nc\n```\n\n### key\u003cspan id=\"filter-key\"\u003e\n\n`key:\u003cname\u003e` or `@\u003cname\u003e`\n\nChange default key for a pipeline. Useful to have last in a pipeline\nto use git commit hash instead of tag name etc or in the middle of\na pipeline if you want to regexp filter on something else than name.\n\n```sh\n$ bump pipeline 'static:1.0:hello=world|@hello'\nworld\n$ bump pipeline 'static:1.0:hello=world|@name'\n1.0\n$ bump pipeline 'static:1.0:hello=world|key:hello'\nworld\n```\n\n### static\u003cspan id=\"filter-static\"\u003e\n\n`static:\u003cname[:key=value:...]\u003e,...`\n\nProduce versions from filter argument.\n\n```sh\n$ bump pipeline 'static:1,2,3,4:key=value:a=b|sort'\n4\n```\n\n### err\u003cspan id=\"filter-err\"\u003e\n\n`err:\u003cerror\u003e`\n\nFail with error message. Used for testing.\n\n```sh\n$ bump pipeline 'err:test'\ntest\n```\n\n\n[#]: sh-end\n\n## Ideas, TODOs and known issues\n\n- GitHub action: PR labels\n- GitHub action: some kind of tests\n- Configuration templates, go package etc?\n- Proper version number for bump itself\n- How to use with hg\n- docker filter: value should be layer hash\n- docker filter: support non-anon-auth\n- Named pipelines, \"ffmpeg|^4\", generate URLs to changelog/diff?\n- Allow to escape `|` in filter argument\n- Sort filter: make smarter? natural sort?\n- Custom verison sort filter somehow, similar to `sort -k` etc?\n- Some kind of cache to better handle multiple invocations\n- HTTP service to run pipelines?\n- bump-ng: Use jq or some other pipe-friednly langauge\n- Some kind help to build URLs that have major.mainor etc, ex: https://host/name-1.2/name-1.3.4.tar.gz\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwader%2Fbump","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwader%2Fbump","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwader%2Fbump/lists"}