Skip to content

Latest commit

 

History

History
103 lines (73 loc) · 4.09 KB

README.md

File metadata and controls

103 lines (73 loc) · 4.09 KB

selfup

CI - Go Status CI - Nix Status

Replace strings if the line contains the definition of how to update itself.

Installation

In Nix Flake, you can skip installation steps

> nix run github:kachick/selfup/v1.1.6 -- --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.6/selfup_Linux_x86_64.tar.gz | tar xvz -C "$install_path" selfup
> "${install_path}/selfup" --version
selfup VERSION (REV)

You can also use gh command.

gh release download 'v1.1.6' --pattern 'selfup_Linux_x86_64.tar.gz' --repo kachick/selfup
tar -xvzf 'selfup_Linux_x86_64.tar.gz'

Usage

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

JSON schema

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("")

Options

  • --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 version

Examples

FAQ

  • selfup run .github does not work. Is there walker option?

    • Just taking target paths, recommend to use as this git ls-files .github | xargs selfup run
  • What are the advantages over version updaters?

Motivation

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.