2 # This script is used to prepare a new release of i3.
4 export RELEASE_VERSION="4.11"
5 export PREVIOUS_VERSION="4.10.4"
6 export RELEASE_BRANCH="next"
8 if [ ! -e "../i3.github.io" ]
10 echo "../i3.github.io does not exist."
11 echo "Use git clone https://github.com/i3/i3.github.io"
15 if ! (cd ../i3.github.io && git pull)
17 echo "Could not update ../i3.github.io repository"
21 if [ ! -e "RELEASE-NOTES-${RELEASE_VERSION}" ]
23 echo "RELEASE-NOTES-${RELEASE_VERSION} not found."
27 if git diff-files --quiet --exit-code debian/changelog
29 echo "Expected debian/changelog to be changed (containing the changelog for ${RELEASE_VERSION})."
33 eval $(gpg-agent --daemon)
36 ################################################################################
37 # Section 1: update git and build the release tarball
38 ################################################################################
44 if ! wget https://i3wm.org/downloads/i3-${PREVIOUS_VERSION}.tar.bz2; then
45 echo "Could not download i3-${PREVIOUS_VERSION}.tar.bz2 (required for comparing files)."
48 git clone --quiet --branch "${RELEASE_BRANCH}" file://${STARTDIR}
50 if [ ! -e "${STARTDIR}/RELEASE-NOTES-${RELEASE_VERSION}" ]; then
51 echo "Required file RELEASE-NOTES-${RELEASE_VERSION} not found."
54 git checkout -b release-${RELEASE_VERSION}
55 cp "${STARTDIR}/RELEASE-NOTES-${RELEASE_VERSION}" "RELEASE-NOTES-${RELEASE_VERSION}"
56 git add RELEASE-NOTES-${RELEASE_VERSION}
57 git rm RELEASE-NOTES-${PREVIOUS_VERSION}
58 sed -i "s,<refmiscinfo class=\"version\">[^<]*</refmiscinfo>,<refmiscinfo class=\"version\">${RELEASE_VERSION}</refmiscinfo>,g" man/asciidoc.conf
59 git commit -a -m "release i3 ${RELEASE_VERSION}"
60 git tag "${RELEASE_VERSION}" -m "release i3 ${RELEASE_VERSION}" --sign --local-user=0x4AC8EE1D
64 echo "Differences in the release tarball file lists:"
67 <(tar tf ../i3-${PREVIOUS_VERSION}.tar.bz2 | sed "s,i3-${PREVIOUS_VERSION}/,,g" | sort) \
68 <(tar tf i3-${RELEASE_VERSION}.tar.bz2 | sed "s,i3-${RELEASE_VERSION}/,,g" | sort) \
71 if ! tar xf i3-${RELEASE_VERSION}.tar.bz2 --to-stdout --strip-components=1 i3-${RELEASE_VERSION}/I3_VERSION | grep -q "^${RELEASE_VERSION} "
73 echo "I3_VERSION file does not start with ${RELEASE_VERSION}"
77 gpg --armor -b i3-${RELEASE_VERSION}.tar.bz2
79 if [ "${RELEASE_BRANCH}" = "master" ]; then
81 git merge --no-ff release-${RELEASE_VERSION} -m "Merge branch 'release-${RELEASE_VERSION}'"
83 git merge --no-ff -X ours master -m "Merge branch 'master' into next"
86 git merge --no-ff release-${RELEASE_VERSION} -m "Merge branch 'release-${RELEASE_VERSION}'"
88 git merge --no-ff -X theirs next -m "Merge branch 'next' into master"
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"
95 git config --add remote.origin.push "+refs/heads/master:refs/heads/master"
97 ################################################################################
98 # Section 2: Debian packaging
99 ################################################################################
104 # Copy over the changelog because we expect it to be locally modified in the
106 cp "${STARTDIR}/debian/changelog" i3/debian/changelog
107 (cd i3 && git add debian/changelog && git commit -m 'Update debian/changelog')
109 cat > ${TMPDIR}/Dockerfile <<EOT
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
113 COPY i3/i3-${RELEASE_VERSION}.tar.bz2 /usr/src/i3-wm_${RELEASE_VERSION}.orig.tar.bz2
115 RUN tar xf i3-wm_${RELEASE_VERSION}.orig.tar.bz2
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
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
126 CONTAINER_NAME=$(echo "i3-${TMPDIR}" | sed 's,/,,g')
128 for file in $(docker run --name "${CONTAINER_NAME}" i3 /bin/sh -c "ls /usr/src/i3*_${RELEASE_VERSION}*")
130 docker cp "${CONTAINER_NAME}:${file}" ${TMPDIR}/debian/
133 echo "Content of resulting package’s .changes file:"
134 cat ${TMPDIR}/debian/*.changes
136 # debsign is in devscripts, which is available in fedora and debian
137 debsign -k4AC8EE1D ${TMPDIR}/debian/*.changes
139 # TODO: docker cleanup
141 ################################################################################
143 ################################################################################
145 # Ensure we are in the correct branch for copying the docs.
147 git checkout ${RELEASE_BRANCH}
150 git clone --quiet ${STARTDIR}/../i3.github.io
152 cp ${TMPDIR}/i3/i3-${RELEASE_VERSION}.tar.bz2* downloads/
153 git add downloads/i3-${RELEASE_VERSION}.tar.bz2*
154 cp ${TMPDIR}/i3/RELEASE-NOTES-${RELEASE_VERSION} downloads/RELEASE-NOTES-${RELEASE_VERSION}.txt
155 git add downloads/RELEASE-NOTES-${RELEASE_VERSION}.txt
156 sed -i "s,<h2>Documentation for i3 v[^<]*</h2>,<h2>Documentation for i3 v${RELEASE_VERSION}</h2>,g" docs/index.html
157 sed -i "s,<span style=\"margin-left: 2em; color: #c0c0c0\">[^<]*</span>,<span style=\"margin-left: 2em; color: #c0c0c0\">${RELEASE_VERSION}</span>,g" index.html
158 sed -i "s,The current stable version is .*$,The current stable version is ${RELEASE_VERSION}.,g" downloads/index.html
159 sed -i "s,<tbody>,<tbody>\n <tr>\n <td>${RELEASE_VERSION}</td>\n <td><a href=\"/downloads/i3-${RELEASE_VERSION}.tar.bz2\">i3-${RELEASE_VERSION}.tar.bz2</a></td>\n <td>$(ls -lh ../i3/i3-${RELEASE_VERSION}.tar.bz2 | awk -F " " {'print $5'} | sed 's/K$/ KiB/g')</td>\n <td><a href=\"/downloads/i3-${RELEASE_VERSION}.tar.bz2.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
161 git commit -a -m "add ${RELEASE_VERSION} release"
163 mkdir docs/${PREVIOUS_VERSION}
164 tar cf - '--exclude=[0-9]\.[0-9e]*' docs | tar xf - --strip-components=1 -C docs/${PREVIOUS_VERSION}
165 git add docs/${PREVIOUS_VERSION}
166 git commit -a -m "save docs for ${PREVIOUS_VERSION}"
168 for i in $(find _docs -maxdepth 1 -and -type f -and \! -regex ".*\.\(html\|man\)$" -and \! -name "Makefile")
170 base="$(basename $i)"
171 [ -e "${TMPDIR}/i3/docs/${base}" ] && cp "${TMPDIR}/i3/docs/${base}" "_docs/${base}"
174 sed -i "s,Verify you are using i3 ≥ .*,Verify you are using i3 ≥ ${RELEASE_VERSION},g" _docs/debugging
178 for i in $(find _docs -maxdepth 1 -and -type f -and \! -regex ".*\.\(html\|man\)$" -and \! -name "Makefile")
180 base="$(basename $i)"
181 [ -e "${TMPDIR}/i3/docs/${base}" ] && cp "_docs/${base}.html" docs/
184 git commit -a -m "update docs for ${RELEASE_VERSION}"
186 git remote remove origin
187 git remote add origin git@github.com:i3/i3.github.io.git
188 git config --add remote.origin.push "+refs/heads/master:refs/heads/master"
190 ################################################################################
191 # Section 4: prepare release announcement email
192 ################################################################################
196 From: Michael Stapelberg <michael@i3wm.org>
197 To: i3-announce@i3.zekjur.net
198 Subject: i3 v${RELEASE_VERSION} released
199 Content-Type: text/plain; charset=utf-8
200 Content-Transfer-Encoding: 8bit
204 I just released i3 v${RELEASE_VERSION}. Release notes follow:
206 cat ${TMPDIR}/i3/RELEASE-NOTES-${RELEASE_VERSION} >>email.txt
208 ################################################################################
209 # Section 5: final push instructions
210 ################################################################################
212 echo "As a final sanity check, install the debian package and see whether i3 works."
214 echo "When satisfied, run:"
215 echo " cd ${TMPDIR}/i3"
216 echo " git checkout next"
217 echo " vi debian/changelog"
218 echo " git commit -a -m \"debian: update changelog\""
221 echo " cd ${TMPDIR}/i3.github.io"
224 echo " cd ${TMPDIR}/debian"
225 echo " dput *.changes"
228 echo " sendmail -t < email.txt"