File: release

package info (click to toggle)
git-autofixup 0.004007-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 228 kB
  • sloc: perl: 1,876; sh: 58; makefile: 2
file content (55 lines) | stat: -rwxr-xr-x 1,139 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/bash
# Release tasks.
#
# This evolved out of following the guide at
# https://www.perl.com/article/how-to-upload-a-script-to-cpan/.

set -euo pipefail

mk_readme() {
    perldoc -u git-autofixup >README.pod
}

mk_tarball() {
    perl Makefile.PL &&
    make dist ||
    return 1
}

upload() {
    local tarball=${1:?No tarball given}; shift
    cpan-upload -u TORBIAK "$tarball"
}

get_version() {
    grep -F 'our $VERSION = ' lib/App/Git/Autofixup.pm git-autofixup
}

set_version() {
    local version=${1:?No version given}; shift
    sed -E -i '/our \$VERSION = [0-9]\.[0-9]+;/c our $VERSION = '"$version"';' \
        lib/App/Git/Autofixup.pm git-autofixup
}

release() {
    local version=${1:?No version given}; shift

    set_version "$version" &&
    mk_readme &&
    prove -l t xt &&
    make manifest ||
    return 1

    if ! grep -E "^# $version" Changes; then
        echo "Section for $version not found in Changes" >&2
        return 1
    fi

    git commit -am "Version $version" &&
    git tag "v$version" &&
    mk_tarball &&
    upload "App-Git-Autofixup-${version%%000}.tar.gz"
}

cd "${BASH_SOURCE%/*}"
"$@"