From 140b9c13a0dbbbaddaa527c4af400f4f51df7e10 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Fri, 14 Apr 2023 10:20:44 +0100 Subject: [PATCH] feat: add create-script and tag-release --- bin/create-script | 18 ++++++++++++++++++ bin/tag-release | 14 ++++++++++++++ home-manager/modules/zsh.nix | 2 ++ 3 files changed, 34 insertions(+) create mode 100755 bin/create-script create mode 100755 bin/tag-release diff --git a/bin/create-script b/bin/create-script new file mode 100755 index 0000000..93aa863 --- /dev/null +++ b/bin/create-script @@ -0,0 +1,18 @@ +#!/usr/bin/env bash + +if [[ "$1" == "" ]]; then + echo "Usage: ${0##*/} "; exit 2 +fi + +set -ueo pipefail + +cat > "${1}" << EOF +#!/usr/bin/env bash + +set -euo pipefail + + +EOF + +chmod +x "${1}" +vim "${1}" diff --git a/bin/tag-release b/bin/tag-release new file mode 100755 index 0000000..eda17dc --- /dev/null +++ b/bin/tag-release @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +if [[ "$1" == "" ]]; then + echo "Usage: ${0##*/} "; exit 2 +fi + +set -euo pipefail + +commit_sha="${1:-HEAD}" +tag="$(date '+%Y-%m-%d-%H.%M.%S')" + +# Tag the appropriate commit and push to the remote. +git tag "${tag}" "${commit_sha}" +git push origin "refs/tags/${tag}" diff --git a/home-manager/modules/zsh.nix b/home-manager/modules/zsh.nix index 95e7f54..f8a032a 100644 --- a/home-manager/modules/zsh.nix +++ b/home-manager/modules/zsh.nix @@ -80,10 +80,12 @@ bindkey " " expand-alias-space bindkey -M isearch " " magic-space + ialias cs="create-script" ialias fetch="git fetch --all --jobs=4 --progress --prune" ialias run="./run" ialias pull="git pull --autostash --jobs=4 --summary origin" ialias rebase="git rebase --autostash --stat" + ialias tag="tag-release" ialias update="fetch && rebase" # Nix and NixOS.