-
Notifications
You must be signed in to change notification settings - Fork 1
/
Walkfile
executable file
·121 lines (101 loc) · 2.12 KB
/
Walkfile
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
#!/bin/bash
set -eo pipefail
# When creating a new release, we'll build for these architectures. Maps to the
# GOOS env var.
release_archs=(darwin linux)
phase=$1
target=$2
install() {
exec go install .
}
# Creates a new release:
#
# 1. Tags the git commit with vX.X.X (from VERSION)
# 2. Creates a GitHub release for the tag.
# 3. Uploads all of the files, which are provided as positional arguments.
release() {
local tag=v$(cat VERSION)
local user=ejholmes
local repo=walk
if [ -z "$GITHUB_TOKEN" ]; then
>&2 echo "GITHUB_TOKEN is missing."
return 1
fi
git tag ${tag} && git push && git push --tags
github-release release \
--user ${user} \
--repo ${repo} \
--tag ${tag}
for f in $@; do
github-release upload \
--user ${user} \
--repo ${repo} \
--tag ${tag} \
--name $(basename $f) \
--file $f
done
}
case $target in
all)
case $phase in
deps)
echo bin
echo test
echo install
echo docs
;;
esac ;;
clean)
case $phase in
deps)
echo test/clean
echo bin/clean
;;
esac ;;
install)
case $phase in
deps) echo src ;;
exec) install ;;
esac ;;
release)
case $phase in
deps)
for arch in ${release_archs[@]}; do
echo bin/walk-$arch
done
echo dist/debian/walk.deb
;;
exec) release $($0 deps $target) ;;
esac ;;
version.go)
case $phase in
deps) echo VERSION ;;
exec)
cat <<EOF > "$target"
// DO NOT MODIFY
// Auto generated from by 'walk version.go'
package main
// Version is the version of walk(1)
const Version = "$(cat VERSION)"
EOF
;;
esac ;;
bundled)
case $phase in
exec) exec bundle install ;
esac ;;
bin|test|docs|man|dist)
case $phase in
deps) echo $target/all ;;
esac ;;
src)
case $phase in
deps) ls *.go | grep -v _test ;;
esac ;;
error)
case $phase in
deps) echo test/000-cancel/fail ;;
esac ;;
VERSION|*.go) ;; # noops
*) >&2 echo "No rule for target \"$target\"" && exit 1 ;;
esac