aboutsummaryrefslogtreecommitdiff
path: root/repo/git/cpt-rel
blob: 3c507574d2d13abf38ffa02d1f72a4718e8c421f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/sh -e
# Bump the release number of a package

case "$1" in
    '') set -- . ;;
    --help|-h) printf '%s\n' "usage: ${0##*/}"; exit 0; esac

for pkg; do (

    cd "$pkg"

    read -r ver rel < version || {
        printf '%s\n' "could not find version file, are you on a package directory?"
        exit 1
    }

    # Update the version file with the new release number
    printf '%s\n' "$ver $(( rel += 1 ))" > version

    # Unstage all changes and add the version file
    git reset; git add version
    git commit -m "${PWD##*/}: bump release number"

) done