Interesting example from justfile documentation: where it create mktemp and set it in variable then by concatenation you get a full path to the tar.gz.
Then the Recipe “publish” create the artifact again and push it to a server.
1tmpdir := `mktemp` # Create a tmp file
2version := "0.2.7"
3tardir := tmpdir / "awesomesauce-" + version
4tarball := tardir + ".tar.gz" # use tmpfile path to create a tarball
5
6publish:
7 rm -f {{tarball}}
8 mkdir {{tardir}}
9 cp README.md *.c {{tardir}}
10 tar zcvf {{tarball}} {{tardir}}
11 scp {{tarball}} me@server.com:release/
12 rm -rf {{tarball}} {{tardir}}
This one can be really usefull to define a default value which can be redefine with env variable:
1# in terminal:
2export REPOSITORY=gitlab.com
3
4# in justfile
5REPOSITORY := env_var_or_default('REPOSITORY', "github.com")
Comments