diff options
author | Hisham Muhammad <hisham@gobolinux.org> | 2019-05-06 15:41:12 -0300 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2019-05-06 15:41:12 -0300 |
commit | 9cb923d86dec6af01d4b4fc93ad1b03b1d18c794 (patch) | |
tree | 92bc39b3d957ce4df8bcf1181c5b87d87e408f12 | |
parent | 505790352ef01da959154da9a2be270a6c21212d (diff) | |
download | luarocks-9cb923d86dec6af01d4b4fc93ad1b03b1d18c794.tar.gz luarocks-9cb923d86dec6af01d4b4fc93ad1b03b1d18c794.tar.bz2 luarocks-9cb923d86dec6af01d4b4fc93ad1b03b1d18c794.zip |
add publishrelease script
-rwxr-xr-x | publishrelease | 197 |
1 files changed, 197 insertions, 0 deletions
diff --git a/publishrelease b/publishrelease new file mode 100755 index 00000000..b464a852 --- /dev/null +++ b/publishrelease | |||
@@ -0,0 +1,197 @@ | |||
1 | #!/usr/bin/env bash | ||
2 | |||
3 | [ "$1" ] || { | ||
4 | echo "usage.....: $0 <version>" | ||
5 | echo "example...: $0 3.1.1" | ||
6 | echo | ||
7 | echo "Before running this, make sure the packages were built:" | ||
8 | echo " makedist 3.1.1 binary sign" | ||
9 | echo "And the tag was merged:" | ||
10 | echo " mergerelease 3.1.1" | ||
11 | echo | ||
12 | exit 1 | ||
13 | } | ||
14 | |||
15 | ####################################### | ||
16 | # preliminary checks | ||
17 | ####################################### | ||
18 | |||
19 | v="$1" | ||
20 | |||
21 | git checkout v$v || { | ||
22 | echo "Could not checkout release tag." | ||
23 | } | ||
24 | |||
25 | packages=( | ||
26 | luarocks-$v-windows-32.zip | ||
27 | luarocks-$v-windows-32.zip.asc | ||
28 | luarocks-$v-linux-x86_64.zip | ||
29 | luarocks-$v-linux-x86_64.zip.asc | ||
30 | luarocks-$v-win32.zip | ||
31 | luarocks-$v-win32.zip.asc | ||
32 | luarocks-$v.tar.gz | ||
33 | luarocks-$v.tar.gz.asc | ||
34 | ) | ||
35 | |||
36 | for f in "${packages[@]}" luarocks-$v-1.rockspec | ||
37 | do | ||
38 | [ -e "$f" ] || { | ||
39 | echo "Missing file $f" | ||
40 | exit 1 | ||
41 | } | ||
42 | done | ||
43 | |||
44 | ####################################### | ||
45 | # utility | ||
46 | ####################################### | ||
47 | |||
48 | function confirm() { | ||
49 | branch="$1" | ||
50 | |||
51 | echo "****************************************" | ||
52 | git diff $branch | ||
53 | echo "****************************************" | ||
54 | git status | ||
55 | echo "****************************************" | ||
56 | |||
57 | echo "Everything looks all right? (y/n)" | ||
58 | echo "(Answering y will commit and push)" | ||
59 | read | ||
60 | if ! [ "$REPLY" == "y" ] | ||
61 | then | ||
62 | git reset | ||
63 | git checkout . | ||
64 | git checkout master | ||
65 | exit 1 | ||
66 | fi | ||
67 | } | ||
68 | |||
69 | ####################################### | ||
70 | # gh-pages | ||
71 | ####################################### | ||
72 | |||
73 | git checkout gh-pages | ||
74 | git fetch origin gh-pages | ||
75 | git reset --hard origin/gh-pages | ||
76 | |||
77 | cp "${packages[@]}" releases | ||
78 | cd releases | ||
79 | git add "${packages[@]}" | ||
80 | gawk ' | ||
81 | /add new release here/ { | ||
82 | print "<!-- add new release here -->" | ||
83 | print "" | ||
84 | 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>" | ||
85 | print "<tr><td><a href=\"luarocks-'$v'-windows-32.zip\">luarocks-'$v'-windows-32.zip</a> (luarocks.exe stand-alone Windows binary)</td><td><a href=\"luarocks-'$v'-windows-32.zip.asc\">PGP signature</a></td></tr>" | ||
86 | 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>" | ||
87 | 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>" | ||
88 | done = 1 | ||
89 | } | ||
90 | // { | ||
91 | if (done == 1) { | ||
92 | done = 0 | ||
93 | } else { | ||
94 | |||
95 | } | ||
96 | } | ||
97 | ' index.html > index.html.1 | ||
98 | mv index.html.1 index.html | ||
99 | git add index.html | ||
100 | |||
101 | gawk ' | ||
102 | /^\[$/ { | ||
103 | go = 1 | ||
104 | } | ||
105 | // { | ||
106 | |||
107 | if (go == 1) { | ||
108 | go = 0 | ||
109 | |||
110 | print "{" | ||
111 | print "\"'$v'\": {" | ||
112 | print "\"date\": \"'$(date +'%Y-%m-%d')'\"," | ||
113 | 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'-linux-x86_64.zip\", \"luarocks-'$v'-linux-x86_64.zip.asc\"]," | ||
114 | print "\"about\": []" | ||
115 | print "}}," | ||
116 | } | ||
117 | } | ||
118 | ' releases.json > releases.json.1 | ||
119 | mv releases.json.1 releases.json | ||
120 | git add releases.json | ||
121 | |||
122 | confirm gh-pages | ||
123 | |||
124 | git commit -av -m "Release $v" | ||
125 | git push | ||
126 | |||
127 | ####################################### | ||
128 | # luarocks.org | ||
129 | ####################################### | ||
130 | |||
131 | git checkout v$v | ||
132 | |||
133 | luarocks upload luarocks-$v-1.rockspec | ||
134 | |||
135 | git checkout master | ||
136 | |||
137 | ####################################### | ||
138 | # luarocks-site | ||
139 | ####################################### | ||
140 | |||
141 | if [ -e ../luarocks-site ] | ||
142 | then | ||
143 | cd ../luarocks-site | ||
144 | else | ||
145 | cd .. | ||
146 | git clone https://github.com/luarocks/luarocks-site | ||
147 | cd luarocks-site | ||
148 | fi | ||
149 | |||
150 | git pull | ||
151 | sed -i 's,luarocks-[0-9]*\.[0-9]*\.[0-9]*,luarocks-'$v',' static/md/home.md | ||
152 | git add static/md/home.md | ||
153 | |||
154 | confirm master | ||
155 | |||
156 | git commit static/md/home.md -m "update front page for LuaRocks $v" | ||
157 | git push | ||
158 | |||
159 | ####################################### | ||
160 | # luarocks.wiki | ||
161 | ####################################### | ||
162 | |||
163 | [ -e ../luarocks.wiki ] || { | ||
164 | cd .. | ||
165 | git clone https://github.com/luarocks/luarocks.wiki.git | ||
166 | } | ||
167 | |||
168 | if [ -e ../luarocks.wiki ] | ||
169 | then | ||
170 | cd ../luarocks.wiki | ||
171 | else | ||
172 | cd .. | ||
173 | git clone https://github.com/luarocks/luarocks.wiki.git | ||
174 | cd luarocks.wiki | ||
175 | fi | ||
176 | |||
177 | sed -i "s,The current stable release is [^:]*:,The current stable release is '''$v''':," Download.mediawiki | ||
178 | |||
179 | gawk ' | ||
180 | BEGIN { | ||
181 | print "'\'\'\''Version '$v\'\'\'' - '$(date +'%d/%b/%Y')' - [http://luarocks.org/releases/luarocks-'$v'.tar.gz All Unix] -" | ||
182 | print "[http://luarocks.org/releases/luarocks-'$v'-windows-32.zip Windows all-in-one executable]" | ||
183 | print "" | ||
184 | } | ||
185 | // { | ||
186 | |||
187 | } | ||
188 | ' "Release-history.mediawiki" > "Release-history.mediawiki.1" | ||
189 | mv "Release-history.mediawiki.1" "Release-history.mediawiki" | ||
190 | |||
191 | git add "Download.mediawiki" | ||
192 | git add "Release-history.mediawiki" | ||
193 | |||
194 | confirm master | ||
195 | |||
196 | git commit -av -m "Release $v" | ||
197 | git push | ||