27
by Javier Lopez
automatic sync 30-03-2015:00:00 |
1 |
#!/bin/zsh
|
2 |
# This script is used to prepare a new release of i3.
|
|
3 |
||
72
by Javier Lopez
automatic sync 16-11-2020:00:01 |
4 |
set -eu
|
5 |
||
124
by Javier Lopez
automatic sync 20-10-2021:00:00 |
6 |
export RELEASE_VERSION="4.20" |
7 |
export PREVIOUS_VERSION="4.19.2" |
|
47
by Javier Lopez
automatic sync 05-11-2018:00:01 |
8 |
export RELEASE_BRANCH="next" |
27
by Javier Lopez
automatic sync 30-03-2015:00:00 |
9 |
|
10 |
if [ ! -e "../i3.github.io" ] |
|
11 |
then
|
|
12 |
echo "../i3.github.io does not exist." |
|
38
by Javier Lopez
automatic sync 07-03-2016:00:00 |
13 |
echo "Use git clone https://github.com/i3/i3.github.io" |
27
by Javier Lopez
automatic sync 30-03-2015:00:00 |
14 |
exit 1 |
15 |
fi
|
|
16 |
||
32
by Javier Lopez
automatic sync 01-10-2015:00:00 |
17 |
if ! (cd ../i3.github.io && git pull) |
18 |
then
|
|
19 |
echo "Could not update ../i3.github.io repository" |
|
20 |
exit 1 |
|
21 |
fi
|
|
22 |
||
27
by Javier Lopez
automatic sync 30-03-2015:00:00 |
23 |
if [ ! -e "RELEASE-NOTES-${RELEASE_VERSION}" ] |
24 |
then
|
|
132
by Javier Lopez
automatic sync 06-11-2021:00:00 |
25 |
echo "RELEASE-NOTES-${RELEASE_VERSION} not found. Here is the output from the generator:" |
26 |
./release-notes/generator.pl --print-urls |
|
27
by Javier Lopez
automatic sync 30-03-2015:00:00 |
27 |
exit 1 |
28 |
fi
|
|
29 |
||
30 |
eval $(gpg-agent --daemon) |
|
31 |
export GPG_AGENT_INFO
|
|
32 |
||
33 |
################################################################################
|
|
34 |
# Section 1: update git and build the release tarball
|
|
35 |
################################################################################
|
|
36 |
||
37 |
STARTDIR=$PWD |
|
38 |
||
39 |
TMPDIR=$(mktemp -d) |
|
40 |
cd $TMPDIR |
|
124
by Javier Lopez
automatic sync 20-10-2021:00:00 |
41 |
if ! wget https://i3wm.org/downloads/i3-${PREVIOUS_VERSION}.tar.xz; then |
42 |
echo "Could not download i3-${PREVIOUS_VERSION}.tar.xz (required for comparing files)." |
|
27
by Javier Lopez
automatic sync 30-03-2015:00:00 |
43 |
exit 1 |
44 |
fi
|
|
39
by Javier Lopez
automatic sync 09-11-2016:00:00 |
45 |
git clone --quiet --branch "${RELEASE_BRANCH}" https://github.com/i3/i3 |
27
by Javier Lopez
automatic sync 30-03-2015:00:00 |
46 |
cd i3
|
47 |
if [ ! -e "${STARTDIR}/RELEASE-NOTES-${RELEASE_VERSION}" ]; then |
|
48 |
echo "Required file RELEASE-NOTES-${RELEASE_VERSION} not found." |
|
49 |
exit 1 |
|
50 |
fi
|
|
51 |
git checkout -b release-${RELEASE_VERSION} |
|
72
by Javier Lopez
automatic sync 16-11-2020:00:01 |
52 |
git rm RELEASE-NOTES-* |
27
by Javier Lopez
automatic sync 30-03-2015:00:00 |
53 |
cp "${STARTDIR}/RELEASE-NOTES-${RELEASE_VERSION}" "RELEASE-NOTES-${RELEASE_VERSION}" |
54 |
git add RELEASE-NOTES-${RELEASE_VERSION} |
|
72
by Javier Lopez
automatic sync 16-11-2020:00:01 |
55 |
# Update the release version:
|
56 |
sed -i "s/^\s*version: '4.[^']*'/ version: '${RELEASE_VERSION}'/" meson.build |
|
57 |
cp meson.build "${TMPDIR}/meson.build" |
|
58 |
# Inject the release date into meson.build for the dist tarball:
|
|
59 |
sed -i "s/'-non-git'/' ($(date +'%Y-%m-%d'))'/" meson.build |
|
27
by Javier Lopez
automatic sync 30-03-2015:00:00 |
60 |
git commit -a -m "release i3 ${RELEASE_VERSION}" |
61 |
git tag "${RELEASE_VERSION}" -m "release i3 ${RELEASE_VERSION}" --sign --local-user=0x4AC8EE1D |
|
62 |
||
39
by Javier Lopez
automatic sync 09-11-2016:00:00 |
63 |
mkdir build |
56
by Javier Lopez
automatic sync 31-07-2020:00:00 |
64 |
(cd build && meson .. && ninja dist) |
72
by Javier Lopez
automatic sync 16-11-2020:00:01 |
65 |
cp build/meson-dist/i3-${RELEASE_VERSION}.tar.xz . |
27
by Javier Lopez
automatic sync 30-03-2015:00:00 |
66 |
|
67 |
echo "Differences in the release tarball file lists:" |
|
68 |
||
56
by Javier Lopez
automatic sync 31-07-2020:00:00 |
69 |
diff --color -u \
|
72
by Javier Lopez
automatic sync 16-11-2020:00:01 |
70 |
<(tar tf ../i3-${PREVIOUS_VERSION}.tar.* | sed "s,i3-${PREVIOUS_VERSION}/,,g" | sort) \ |
71 |
<(tar tf i3-${RELEASE_VERSION}.tar.xz | sed "s,i3-${RELEASE_VERSION}/,,g" | sort) || true |
|
56
by Javier Lopez
automatic sync 31-07-2020:00:00 |
72 |
|
73 |
gpg --armor -b i3-${RELEASE_VERSION}.tar.xz |
|
27
by Javier Lopez
automatic sync 30-03-2015:00:00 |
74 |
|
72
by Javier Lopez
automatic sync 16-11-2020:00:01 |
75 |
mv "${TMPDIR}/meson.build" . |
76 |
git add meson.build |
|
77 |
git commit -a -m "Restore non-git version suffix"
|
|
39
by Javier Lopez
automatic sync 09-11-2016:00:00 |
78 |
|
56
by Javier Lopez
automatic sync 31-07-2020:00:00 |
79 |
if [ "${RELEASE_BRANCH}" = "stable" ]; then |
80 |
git checkout stable |
|
27
by Javier Lopez
automatic sync 30-03-2015:00:00 |
81 |
git merge --no-ff release-${RELEASE_VERSION} -m "Merge branch 'release-${RELEASE_VERSION}'" |
82 |
git checkout next |
|
56
by Javier Lopez
automatic sync 31-07-2020:00:00 |
83 |
git merge --no-ff -s recursive -X ours -X no-renames stable -m "Merge branch 'stable' into next"
|
27
by Javier Lopez
automatic sync 30-03-2015:00:00 |
84 |
else
|
85 |
git checkout next |
|
86 |
git merge --no-ff release-${RELEASE_VERSION} -m "Merge branch 'release-${RELEASE_VERSION}'" |
|
56
by Javier Lopez
automatic sync 31-07-2020:00:00 |
87 |
git checkout stable |
88 |
git merge --no-ff -s recursive -X theirs -X no-renames next -m "Merge branch 'next' into stable"
|
|
27
by Javier Lopez
automatic sync 30-03-2015:00:00 |
89 |
fi
|
90 |
||
32
by Javier Lopez
automatic sync 01-10-2015:00:00 |
91 |
git remote remove origin |
92 |
git remote add origin git@github.com:i3/i3.git |
|
93 |
git config --add remote.origin.push "+refs/tags/*:refs/tags/*"
|
|
94 |
git config --add remote.origin.push "+refs/heads/next:refs/heads/next"
|
|
56
by Javier Lopez
automatic sync 31-07-2020:00:00 |
95 |
git config --add remote.origin.push "+refs/heads/stable:refs/heads/stable"
|
32
by Javier Lopez
automatic sync 01-10-2015:00:00 |
96 |
|
27
by Javier Lopez
automatic sync 30-03-2015:00:00 |
97 |
################################################################################
|
72
by Javier Lopez
automatic sync 16-11-2020:00:01 |
98 |
# Section 2: Debian packaging (for QA)
|
27
by Javier Lopez
automatic sync 30-03-2015:00:00 |
99 |
################################################################################
|
100 |
||
101 |
cd "${TMPDIR}" |
|
102 |
mkdir debian |
|
103 |
||
124
by Javier Lopez
automatic sync 20-10-2021:00:00 |
104 |
# Copy over the changelog because we expect it to be locally modified in the
|
105 |
# start directory.
|
|
106 |
cp "${STARTDIR}/debian/changelog" i3/debian/changelog |
|
107 |
(cd i3 && git add debian/changelog && git commit -m 'Update debian/changelog') |
|
108 |
||
27
by Javier Lopez
automatic sync 30-03-2015:00:00 |
109 |
cat > ${TMPDIR}/Dockerfile <<EOT |
110 |
FROM debian:sid
|
|
111 |
RUN sed -i 's,^deb \(.*\),deb \1\ndeb-src \1,g' /etc/apt/sources.list
|
|
112 |
RUN apt-get update && apt-get install -y dpkg-dev devscripts
|
|
56
by Javier Lopez
automatic sync 31-07-2020:00:00 |
113 |
COPY i3/i3-${RELEASE_VERSION}.tar.xz /usr/src/i3-wm_${RELEASE_VERSION}.orig.tar.xz
|
27
by Javier Lopez
automatic sync 30-03-2015:00:00 |
114 |
WORKDIR /usr/src/
|
56
by Javier Lopez
automatic sync 31-07-2020:00:00 |
115 |
RUN tar xf i3-wm_${RELEASE_VERSION}.orig.tar.xz
|
27
by Javier Lopez
automatic sync 30-03-2015:00:00 |
116 |
WORKDIR /usr/src/i3-${RELEASE_VERSION}
|
117 |
COPY i3/debian /usr/src/i3-${RELEASE_VERSION}/debian/
|
|
118 |
RUN mkdir debian/source
|
|
119 |
RUN echo '3.0 (quilt)' > debian/source/format
|
|
120 |
WORKDIR /usr/src
|
|
121 |
RUN mk-build-deps --install --remove --tool 'apt-get --no-install-recommends -y' i3-${RELEASE_VERSION}/debian/control
|
|
122 |
WORKDIR /usr/src/i3-${RELEASE_VERSION}
|
|
123 |
RUN dpkg-buildpackage -sa -j8
|
|
47
by Javier Lopez
automatic sync 05-11-2018:00:01 |
124 |
RUN dpkg-buildpackage -S -sa -j8
|
27
by Javier Lopez
automatic sync 30-03-2015:00:00 |
125 |
EOT
|
126 |
||
127 |
CONTAINER_NAME=$(echo "i3-${TMPDIR}" | sed 's,/,,g') |
|
56
by Javier Lopez
automatic sync 31-07-2020:00:00 |
128 |
docker build --no-cache -t i3 . |
27
by Javier Lopez
automatic sync 30-03-2015:00:00 |
129 |
for file in $(docker run --name "${CONTAINER_NAME}" i3 /bin/sh -c "ls /usr/src/i3*_${RELEASE_VERSION}*") |
130 |
do
|
|
131 |
docker cp "${CONTAINER_NAME}:${file}" ${TMPDIR}/debian/ |
|
132 |
done
|
|
133 |
||
134 |
echo "Content of resulting package’s .changes file:" |
|
135 |
cat ${TMPDIR}/debian/*.changes |
|
136 |
||
137 |
# TODO: docker cleanup
|
|
138 |
||
139 |
################################################################################
|
|
140 |
# Section 3: website
|
|
141 |
################################################################################
|
|
142 |
||
32
by Javier Lopez
automatic sync 01-10-2015:00:00 |
143 |
# Ensure we are in the correct branch for copying the docs.
|
144 |
cd ${TMPDIR}/i3 |
|
145 |
git checkout ${RELEASE_BRANCH} |
|
146 |
||
27
by Javier Lopez
automatic sync 30-03-2015:00:00 |
147 |
cd ${TMPDIR} |
148 |
git clone --quiet ${STARTDIR}/../i3.github.io |
|
149 |
cd i3.github.io
|
|
50
by Javier Lopez
automatic sync 04-08-2019:00:00 |
150 |
|
151 |
mkdir docs/${PREVIOUS_VERSION} |
|
152 |
tar cf - '--exclude=[0-9]\.[0-9e]*' docs | tar xf - --strip-components=1 -C docs/${PREVIOUS_VERSION} |
|
153 |
git add docs/${PREVIOUS_VERSION} |
|
154 |
git commit -a -m "save docs for ${PREVIOUS_VERSION}" |
|
155 |
||
56
by Javier Lopez
automatic sync 31-07-2020:00:00 |
156 |
cp ${TMPDIR}/i3/i3-${RELEASE_VERSION}.tar.xz* downloads/ |
157 |
git add downloads/i3-${RELEASE_VERSION}.tar.xz* |
|
27
by Javier Lopez
automatic sync 30-03-2015:00:00 |
158 |
cp ${TMPDIR}/i3/RELEASE-NOTES-${RELEASE_VERSION} downloads/RELEASE-NOTES-${RELEASE_VERSION}.txt |
159 |
git add downloads/RELEASE-NOTES-${RELEASE_VERSION}.txt |
|
160 |
sed -i "s,<h2>Documentation for i3 v[^<]*</h2>,<h2>Documentation for i3 v${RELEASE_VERSION}</h2>,g" docs/index.html |
|
161 |
sed -i "s,<span style=\"margin-left: 2em; color: #c0c0c0\">[^<]*</span>,<span style=\"margin-left: 2em; color: #c0c0c0\">${RELEASE_VERSION}</span>,g" index.html |
|
162 |
sed -i "s,The current stable version is .*$,The current stable version is ${RELEASE_VERSION}.,g" downloads/index.html |
|
56
by Javier Lopez
automatic sync 31-07-2020:00:00 |
163 |
sed -i "s,<tbody>,<tbody>\n <tr>\n <td>${RELEASE_VERSION}</td>\n <td><a href=\"/downloads/i3-${RELEASE_VERSION}.tar.xz\">i3-${RELEASE_VERSION}.tar.xz</a></td>\n <td>$(LC_ALL=en_US.UTF-8 ls -lh ../i3/i3-${RELEASE_VERSION}.tar.xz | awk -F " " {'print $5'} | sed 's/K$/ KiB/g' | sed 's/M$/ MiB/g')</td>\n <td><a href=\"/downloads/i3-${RELEASE_VERSION}.tar.xz.asc\">signature</a></td>\n <td>$(date +'%Y-%m-%d')</td>\n <td><a href=\"/downloads/RELEASE-NOTES-${RELEASE_VERSION}.txt\">release notes</a></td>\n </tr>\n,g" downloads/index.html |
27
by Javier Lopez
automatic sync 30-03-2015:00:00 |
164 |
|
165 |
git commit -a -m "add ${RELEASE_VERSION} release" |
|
166 |
||
167 |
for i in $(find _docs -maxdepth 1 -and -type f -and \! -regex ".*\.\(html\|man\)$" -and \! -name "Makefile") |
|
168 |
do
|
|
169 |
base="$(basename $i)" |
|
32
by Javier Lopez
automatic sync 01-10-2015:00:00 |
170 |
[ -e "${TMPDIR}/i3/docs/${base}" ] && cp "${TMPDIR}/i3/docs/${base}" "_docs/${base}" |
27
by Javier Lopez
automatic sync 30-03-2015:00:00 |
171 |
done
|
172 |
||
32
by Javier Lopez
automatic sync 01-10-2015:00:00 |
173 |
sed -i "s,Verify you are using i3 ≥ .*,Verify you are using i3 ≥ ${RELEASE_VERSION},g" _docs/debugging |
174 |
||
27
by Javier Lopez
automatic sync 30-03-2015:00:00 |
175 |
(cd _docs && make) |
176 |
||
72
by Javier Lopez
automatic sync 16-11-2020:00:01 |
177 |
for i in $(find _docs -maxdepth 1 -and -type f -and \! -regex ".*\.\(html\|man\|css\)$" -and \! -name "Makefile") |
27
by Javier Lopez
automatic sync 30-03-2015:00:00 |
178 |
do
|
179 |
base="$(basename $i)" |
|
32
by Javier Lopez
automatic sync 01-10-2015:00:00 |
180 |
[ -e "${TMPDIR}/i3/docs/${base}" ] && cp "_docs/${base}.html" docs/ |
27
by Javier Lopez
automatic sync 30-03-2015:00:00 |
181 |
done
|
182 |
||
183 |
git commit -a -m "update docs for ${RELEASE_VERSION}" |
|
184 |
||
32
by Javier Lopez
automatic sync 01-10-2015:00:00 |
185 |
git remote remove origin |
186 |
git remote add origin git@github.com:i3/i3.github.io.git |
|
187 |
git config --add remote.origin.push "+refs/heads/master:refs/heads/master"
|
|
188 |
||
189 |
################################################################################
|
|
190 |
# Section 4: prepare release announcement email
|
|
191 |
################################################################################
|
|
192 |
||
193 |
cd ${TMPDIR} |
|
194 |
cat >email.txt <<EOT
|
|
195 |
From: Michael Stapelberg <michael@i3wm.org>
|
|
39
by Javier Lopez
automatic sync 09-11-2016:00:00 |
196 |
To: i3-announce@freelists.org
|
32
by Javier Lopez
automatic sync 01-10-2015:00:00 |
197 |
Subject: i3 v${RELEASE_VERSION} released
|
198 |
Content-Type: text/plain; charset=utf-8
|
|
199 |
Content-Transfer-Encoding: 8bit
|
|
200 |
||
201 |
Hi,
|
|
202 |
||
203 |
I just released i3 v${RELEASE_VERSION}. Release notes follow:
|
|
204 |
EOT
|
|
205 |
cat ${TMPDIR}/i3/RELEASE-NOTES-${RELEASE_VERSION} >>email.txt |
|
206 |
||
207 |
################################################################################
|
|
208 |
# Section 5: final push instructions
|
|
27
by Javier Lopez
automatic sync 30-03-2015:00:00 |
209 |
################################################################################
|
210 |
||
211 |
echo "As a final sanity check, install the debian package and see whether i3 works." |
|
212 |
||
213 |
echo "When satisfied, run:" |
|
214 |
echo " cd ${TMPDIR}/i3" |
|
215 |
echo " git checkout next" |
|
216 |
echo " vi debian/changelog" |
|
32
by Javier Lopez
automatic sync 01-10-2015:00:00 |
217 |
echo " git commit -a -m \"debian: update changelog\"" |
218 |
echo " git push" |
|
27
by Javier Lopez
automatic sync 30-03-2015:00:00 |
219 |
echo "" |
220 |
echo " cd ${TMPDIR}/i3.github.io" |
|
32
by Javier Lopez
automatic sync 01-10-2015:00:00 |
221 |
echo " git push" |
27
by Javier Lopez
automatic sync 30-03-2015:00:00 |
222 |
echo "" |
223 |
echo " cd ${TMPDIR}/debian" |
|
47
by Javier Lopez
automatic sync 05-11-2018:00:01 |
224 |
echo " dput" |
27
by Javier Lopez
automatic sync 30-03-2015:00:00 |
225 |
echo "" |
32
by Javier Lopez
automatic sync 01-10-2015:00:00 |
226 |
echo " cd ${TMPDIR}" |
227 |
echo " sendmail -t < email.txt" |
|
228 |
echo "" |
|
46
by Javier Lopez
automatic sync 11-03-2018:00:01 |
229 |
echo "Update milestones on GitHub (only for new major versions):" |
230 |
echo " Set due date of ${RELEASE_VERSION} to $(date +'%Y-%m-%d') and close the milestone" |
|
231 |
echo " Create milestone for the next major version with unset due date" |
|
40
by Javier Lopez
automatic sync 05-09-2017:00:00 |
232 |
echo "" |
27
by Javier Lopez
automatic sync 30-03-2015:00:00 |
233 |
echo "Announce on:" |
234 |
echo " twitter" |
|
235 |
echo " #i3 topic" |
|
72
by Javier Lopez
automatic sync 16-11-2020:00:01 |
236 |
echo " reddit /r/i3wm (link post to changelog)" |
118
by Javier Lopez
automatic sync 11-09-2021:00:00 |
237 |
echo " GitHub Discussions → Announcements" |