Replace strings if the line contains the definition of how to update itself.
In Nix Flake, you can skip installation steps
> nix run github:kachick/selfup/v1.1.3 -- --version
selfup dev (rev)
Prebuilt binaries are available for download from releases
> install_path="$(mktemp -d)"
> curl -L https://github.com/kachick/selfup/releases/download/v1.1.3/selfup_Linux_x86_64.tar.gz | tar xvz -C "$install_path" selfup
> "${install_path}/selfup" --version
selfup VERSION (REV)
selfup [SUB] [OPTIONS] [PATH]...
Assume some GitHub actions workflow have lines like follows
- uses: dprint/[email protected]
with:
dprint-version: '0.40.2' # selfup { "extract": "\\d[^']+", "replacer": ["dprint", "--version"], "nth": 2 }
Then you can call selfup as this
selfup run .github/workflows/*.yml
You can check the running plans with list
subcommand
> selfup list .github/workflows/*.yml
.github/workflows/lint.yml:17: 0.40.2
✓ .github/workflows/release.yml:37: 1.20.0 => 1.42.9
.github/workflows/release.yml:50: 3.3.1
1/3 items will be replaced
Field | Type | Description |
---|---|---|
extract | string | Golang regex like RE2, remember to escape meta characters in JSON |
replacer | []string | Command and the arguments. Use ["bash", "-c", "your_script | as_using_pipe"] for script style |
nth | number | Cut the fields, First is 1 , will work no fields mode by default(0 ) |
delimiter | string | Split the STDOUT to make fields, using strings.Fields by default("" ) |
--prefix
: Set customized prefix to begin the JSON--skip-by
: Skips to parse JSON and runs if the line includes this string--check
: Exit with non 0 value if found changes or the plans--no-color
: Avoid to wrap colors even if executed in terminal--version
: Print the versionselfup run .github
does not work. Is there walker option?
git ls-files .github | xargs selfup run
What are the advantages over version updaters?
I'm using this tool to update tool versions in several GitHub actions. Especially I want to synchronize them with Nix shells.
Nix and the ecosystem provide useful CIs, but the runtime footprint is not small even for small changes. So I'm currently using both Nix CI and some tools CIs.