File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11[package ]
22name = " shaka"
3- version = " 0.0.3"
43edition = " 2024"
5- description = " Generate shell aliases and functions from YAML/JSONC config files"
6- license = " MIT"
4+ version = " 0.0.3"
75readme = " README.md"
6+ license = " MIT"
7+ description = " Generate shell aliases and functions from YAML/JSONC config files"
88
99[dependencies ]
1010indexmap = " 2"
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+ set -euo pipefail
3+
4+ version=" $( awk -F ' "' ' /^version[[:space:]]*=/{print $2; exit}' Cargo.toml) "
5+
6+ if [ -z " $version " ]; then
7+ printf ' Could not read version from Cargo.toml\n' >&2
8+ exit 1
9+ fi
10+
11+ tag=" v$version "
12+
13+ local_exists=false
14+ remote_exists=false
15+
16+ if git rev-parse -q --verify " refs/tags/$tag " > /dev/null; then
17+ local_exists=true
18+ fi
19+
20+ if git ls-remote --tags origin " refs/tags/$tag " | grep -q . ; then
21+ remote_exists=true
22+ fi
23+
24+ if [ " $local_exists " = true ] || [ " $remote_exists " = true ]; then
25+ printf ' Tag %s already exists.\n' " $tag "
26+ read -r -p " Delete and recreate tag $tag ? [y/N]: " answer
27+
28+ case " $answer " in
29+ y | Y | yes | YES)
30+ ;;
31+ * )
32+ printf ' Cancelled.\n'
33+ exit 1
34+ ;;
35+ esac
36+
37+ if [ " $local_exists " = true ]; then
38+ git tag -d " $tag "
39+ fi
40+
41+ if [ " $remote_exists " = true ]; then
42+ git push origin " :refs/tags/$tag "
43+ fi
44+ fi
45+
46+ git tag " $tag "
47+ git push origin " $tag "
48+
49+ printf ' Published %s\n' " $tag "
You can’t perform that action at this time.
0 commit comments