Gather small helpers and scripts, in different languages, mostly for personal usage, but who knows, there might be something for you in there.
About the scripts:
- They should be glue scripts i.e. not use too much intricate logic, but serve as glueing a few specific commands and utils together.
- They should come with a fair amount of unit- and integration-tests.
- They should be structured enough for a non script expert to understand.
- If growing, or beneficial in a more general sense, make no mistake - they should be obsoleted, and rewritten in a more robust language. Even better - be submitted as a PR to any relevant project where the overall function itself would feel at home.
bash/src/changelog_release.bash
- A util script to making an atomic release commit including an tag, changelog, updated project file. mvn, npm or gradle. Relies on Conventional Commits-standard.bash/src/dirsumgen.bash
- A wrapper for the creating md5 and sha256 sums for directory trees. One of each for each dir.bash/src/export_gpg.sh
- A script which exports your GPG private-, public keys and owner trust data (to a directory with locked down permissions).
./bash/src/<script>.bash -h
To make a nice release commit might need a few boring steps - adding a changelog, tagging, update project verison. Add Conventional commits, signing and signoffs. It is easy to forget and miss something. So why not make it easier, a one step process:
This script:
- calculate and tags next semver tag
- generates a changelog
- updates the project file version with the version tag
- commits the changelog and tag in a release commit
- Your project is following Conventional Commits Standard.
- Your Git Settings is configured to sign and tag with SSH.
- You need
asdf-vm
installed to easily download all dependencies for the script.
- Clone this repo
git@github.com:janderssonse/janderscripts.git
-
Easiest is to install asdf-vm
-
Install the needed dependencies. Here are two commands that adds the plugins and then installs them for you. Note it will set them globally, but you can later switch versions easily with asdf, if needed for other projects.
# add asdf plugins from .tool-versions
$ cut -d' ' -f1 .tool-versions | xargs -i asdf plugin add {}
# install all listed .tool-versions plugins versions
$ asdf install
# pin the asdf versions
$ asdf global install git-chglog 0.15.4
$ asdf global install java adoptopenjdk-17.0.6+10
$ asdf global install maven 3.8.7
$ asdf global install nodejs 18.4.0
$ asdf global install semver 3.4.0
- From the root dir of the project you are about to update a changelog to, do
/path/to/janderscriptsrepo/you/just/cloned/bash/src/changelog_release.bash --help
There is a helpscript which will mount ssh agent and more for you.
/path/to/repo/you/just/cloned/scripts/run_changelog_release_container.sh '--help'
And you should get an overview of options. NOTE: as you run in an container, arguments will have to be given in one string surrounded by ''
The script requires that you are following the conventional commit format, and the commits and tags will be gpg-signed and signed off.
changelog_release with --help option changelog_release run changelog_release generated changelog example changelog_release commit example - project file, changelog, tag and release commit messageA script which exports your private keys, public keys and owner trust data (to a directory with locked down permissions).
I use it with YADM handle encryption/decryption of the export, and easily move between environments.
YADM-usage:
Put a pattern of .gnupg/.exported-keyring/*
into .config/yadm/config
and use YADM encrypt/decrypt.
$ gpg --import "$HOME/.gnupg/.exported-keyring"/*.asc
$ gpg --import-ownertrust "$HOME/.gnupg/.exported-keyring"/ownertrust.txt
Install bats-core with support libs.
- To Install the Bats-core dependencies where the bats scripts can find them (/bash/lib):
./bash/install_bats.bash
- To run the tests:
./bash/lib/bats/bin/bats bash/src/test
- Run a script:
./bash/src/<script>.bash -h
See CONTRIBUTING.
Scripts in this project are licensed under the MIT LICENSE.
The Bats project - for making us create robust Bash-scripts.