Replace strings in files using update rules defined in comments.
In Nix Flake, you can skip installation steps
> nix run github:kachick/selfup/v1.3.1 -- --version
selfup v1.3.1You can also use the binary cache defined in the flake.
This is available for recent tagged versions, but only if the user is a trusted-user in your nix.conf file.
> grep trusted-users /etc/nix/nix.conf
trusted-users = root your_user
> nix run --accept-flake-config github:kachick/selfup/v1.3.1 -- --version
selfup v1.3.1Prebuilt binaries are available for download from releases
> install_path="$(mktemp -d)"
> curl -L https://github.com/kachick/selfup/releases/download/v1.3.1/selfup_Linux_x86_64.tar.gz | tar xvz -C "$install_path" selfup
> "${install_path}/selfup" --version
selfup VERSIONYou can also use gh command.
gh release download 'v1.3.1' --pattern 'selfup_Linux_x86_64.tar.gz' --repo kachick/selfup
tar -xvzf 'selfup_Linux_x86_64.tar.gz'selfup [SUB] [OPTIONS] [PATH]...
Assume a GitHub Actions workflow has lines like this:
- uses: dprint/check@v2.2
with:
dprint-version: '0.40.2' # selfup { "extract": "\\b[0-9.]+", "replacer": ["dprint", "--version"], "nth": 2 }You can run selfup like this:
selfup run .github/workflows/*.ymlYou can check the plans with the 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 arguments. Use ["bash", "-c", "your_script | as_using_pipe"] for script style. |
| nth | number | Field number. The first field is 1. By default, it uses the whole line (0). |
| delimiter | string | Separator to split STDOUT into fields. It uses strings.Fields by default. |
--prefix: Set a custom prefix pattern (RE2) before the JSON.--skip-by: Skip lines that contain this string.--check: Exit with a non-zero code if changes or plans are found.--no-color: Disable colored output.--version: Print the version.
-
selfup run .githubdoes not work. Is there a walker option?- It only takes target paths. One way to use it is:
git ls-files -z .github | xargs --null selfup run --
- It only takes target paths. One way to use it is:
-
What are the advantages over other version updaters?
- Dependabot does not have this feature.
- Renovate only has it in self-hosted runners.
- In my case, I need to sync versions with nixpkgs, not always the latest.
Both Renovate and Dependabot do not fit this use case.
I use this tool to update tool versions in several GitHub Actions. I especially want to synchronize them with Nix shells.
Nix and its ecosystem provide useful CI, but the runtime footprint is not small even for small changes.
So I currently use both Nix CI and some tool-specific CIs.
This tool modifies your codebase based on external command results.
Please use it only with commands and tools you trust.