forked from luarocks/luarocks
-
Notifications
You must be signed in to change notification settings - Fork 6
/
publishrelease
executable file
·213 lines (176 loc) · 5.71 KB
/
publishrelease
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
#!/usr/bin/env bash
[ "$1" ] || {
echo "usage.....: $0 <version>"
echo "example...: $0 3.1.1"
echo
echo "Before running this, make sure the packages were built:"
echo " makedist 3.1.1 binary sign"
echo "And the tag was merged:"
echo " mergerelease 3.1.1"
echo
exit 1
}
#######################################
# preliminary checks
#######################################
v="$1"
git checkout v$v || {
echo "Could not checkout release tag."
}
packages=(
luarocks-$v-windows-32.zip
luarocks-$v-windows-32.zip.asc
luarocks-$v-windows-64.zip
luarocks-$v-windows-64.zip.asc
luarocks-$v-linux-x86_64.zip
luarocks-$v-linux-x86_64.zip.asc
luarocks-$v-win32.zip
luarocks-$v-win32.zip.asc
luarocks-$v.tar.gz
luarocks-$v.tar.gz.asc
)
for f in "${packages[@]}" luarocks-$v-1.rockspec
do
[ -e "$f" ] || {
echo "Missing file $f"
exit 1
}
done
#######################################
# utility
#######################################
function confirm() {
branch="$1"
echo "****************************************"
git diff $branch
echo "****************************************"
git status
echo "****************************************"
echo "Everything looks all right? (y/n)"
echo "(Answering y will commit and push)"
read
if ! [ "$REPLY" == "y" ]
then
git reset
git checkout .
git checkout master
exit 1
fi
}
#######################################
# luarocks.org
#######################################
luarocks upload luarocks-$v-1.rockspec
#######################################
# gh-pages
#######################################
git checkout gh-pages
git fetch origin gh-pages
git reset --hard origin/gh-pages
cp "${packages[@]}" releases
cd releases
git add "${packages[@]}"
gawk '
/add new release here/ {
print "<!-- add new release here -->"
print ""
print "<tr><td><a href=\"luarocks-'$v'.tar.gz\">luarocks-'$v'.tar.gz</a></td><td><a href=\"luarocks-'$v'.tar.gz.asc\">PGP signature</a></td></tr>"
print "<tr><td><a href=\"luarocks-'$v'-windows-32.zip\">luarocks-'$v'-windows-32.zip</a> (luarocks.exe stand-alone Windows 32-bit binary)</td><td><a href=\"luarocks-'$v'-windows-32.zip.asc\">PGP signature</a></td></tr>"
print "<tr><td><a href=\"luarocks-'$v'-windows-64.zip\">luarocks-'$v'-windows-64.zip</a> (luarocks.exe stand-alone Windows 64-bit binary)</td><td><a href=\"luarocks-'$v'-windows-64.zip.asc\">PGP signature</a></td></tr>"
print "<tr><td><a href=\"luarocks-'$v'-linux-x86_64.zip\">luarocks-'$v'-linux-x86_64.zip</a> (luarocks stand-alone Linux x86_64 binary)</td><td><a href=\"luarocks-'$v'-linux-x86_64.zip.asc\">PGP signature</a></td></tr>"
print "<tr><td><a href=\"luarocks-'$v'-win32.zip\">luarocks-'$v'-win32.zip</a> (legacy Windows package, includes Lua 5.1)</td><td><a href=\"luarocks-'$v'-win32.zip.asc\">PGP signature</a></td></tr>"
done = 1
}
// {
if (done == 1) {
done = 0
} else {
print
}
}
' index.html > index.html.1
mv index.html.1 index.html
git add index.html
gawk '
/^\[$/ {
go = 1
}
// {
print
if (go == 1) {
go = 0
print "{"
print "\"'$v'\": {"
print "\"date\": \"'$(date +'%Y-%m-%d')'\","
print "\"files\": [\"luarocks-'$v'.tar.gz\", \"luarocks-'$v'.tar.gz.asc\", \"luarocks-'$v'-win32.zip\", \"luarocks-'$v'-win32.zip.asc\", \"luarocks-'$v'-windows-32.zip\", \"luarocks-'$v'-windows-32.zip.asc\", \"luarocks-'$v'-windows-64.zip\", \"luarocks-'$v'-windows-64.zip.asc\", \"luarocks-'$v'-linux-x86_64.zip\", \"luarocks-'$v'-linux-x86_64.zip.asc\"],"
print "\"about\": []"
print "}},"
}
}
' releases.json > releases.json.1
mv releases.json.1 releases.json
git add releases.json
confirm gh-pages
git commit -av -m "Release $v"
git push
#######################################
# luarocks.org
#######################################
git checkout v$v
luarocks upload luarocks-$v-1.rockspec
git checkout master
#######################################
# luarocks-site
#######################################
if [ -e ../luarocks-site ]
then
cd ../luarocks-site
git pull
else
cd ..
git clone ssh://[email protected]/luarocks/luarocks-site
cd luarocks-site
fi
sed -i 's,luarocks-[0-9]*\.[0-9]*\.[0-9]*,luarocks-'$v',' static/md/home.md
git add static/md/home.md
confirm master
git commit static/md/home.md -m "update front page for LuaRocks $v"
git push
#######################################
# luarocks.wiki
#######################################
[ -e ../luarocks.wiki ] || {
cd ..
git clone ssh://[email protected]/luarocks/luarocks.wiki.git
}
if [ -e ../luarocks.wiki ]
then
cd ../luarocks.wiki
git pull
else
cd ..
git clone ssh://[email protected]/luarocks/luarocks.wiki.git
cd luarocks.wiki
fi
sed -i "s,Latest release: .*,Latest release: '''LuaRocks $v''' - '$(date +'%d/%b/%Y')'," Download.mediawiki
sed -i "s,/luarocks-[0-9.]*[0-9],/luarocks-$v,g" Download.mediawiki
gawk '
BEGIN {
print "'\'\'\''Version '$v\'\'\'' - '$(date +'%d/%b/%Y')' - [http://luarocks.org/releases/luarocks-'$v'.tar.gz Source tarball for Unix] -"
print "[http://luarocks.org/releases/luarocks-'$v'-windows-32.zip Windows binary (32-bit)] -"
print "[http://luarocks.org/releases/luarocks-'$v'-windows-64.zip Windows binary (64-bit)] -"
print "[http://luarocks.org/releases/luarocks-'$v'-linux-x86_64.zip Linux binary (x86_64)] -"
print "[http://luarocks.github.io/luarocks/releases other files]"
print ""
}
// {
print
}
' "Release-history.mediawiki" > "Release-history.mediawiki.1"
mv "Release-history.mediawiki.1" "Release-history.mediawiki"
git add "Download.mediawiki"
git add "Release-history.mediawiki"
git add "Installation-instructions-for-Unix.md"
confirm master
git commit -av -m "Release $v"
git push