2 # This script is used to prepare a new release of i3.
4 export RELEASE_VERSION="4.16"
5 export PREVIOUS_VERSION="4.15"
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}" https://github.com/i3/i3
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,RELEASE-NOTES-${PREVIOUS_VERSION},RELEASE-NOTES-${RELEASE_VERSION},g" Makefile.am
59 sed -i "s/AC_INIT(\[i3\], \[${PREVIOUS_VERSION}\]/AC_INIT([i3], [${RELEASE_VERSION}]/" configure.ac
60 echo "${RELEASE_VERSION} ($(date +%F))" > I3_VERSION
62 git commit -a -m "release i3 ${RELEASE_VERSION}"
63 git tag "${RELEASE_VERSION}" -m "release i3 ${RELEASE_VERSION}" --sign --local-user=0x4AC8EE1D
67 (cd build && ../configure && make dist-bzip2 -j8)
68 cp build/i3-${RELEASE_VERSION}.tar.bz2 .
70 echo "Differences in the release tarball file lists:"
73 <(tar tf ../i3-${PREVIOUS_VERSION}.tar.bz2 | sed "s,i3-${PREVIOUS_VERSION}/,,g" | sort) \
74 <(tar tf i3-${RELEASE_VERSION}.tar.bz2 | sed "s,i3-${RELEASE_VERSION}/,,g" | sort) \
78 gpg --armor -b i3-${RELEASE_VERSION}.tar.bz2
80 echo "${RELEASE_VERSION}-non-git" > I3_VERSION
82 git commit -a -m "Set non-git version to ${RELEASE_VERSION}-non-git."
84 if [ "${RELEASE_BRANCH}" = "master" ]; then
86 git merge --no-ff release-${RELEASE_VERSION} -m "Merge branch 'release-${RELEASE_VERSION}'"
88 git merge --no-ff -s recursive -X ours -X no-renames master -m "Merge branch 'master' into next"
91 git merge --no-ff release-${RELEASE_VERSION} -m "Merge branch 'release-${RELEASE_VERSION}'"
93 git merge --no-ff -s recursive -X theirs -X no-renames next -m "Merge branch 'next' into master"
96 git remote remove origin
97 git remote add origin git@github.com:i3/i3.git
98 git config --add remote.origin.push "+refs/tags/*:refs/tags/*"
99 git config --add remote.origin.push "+refs/heads/next:refs/heads/next"
100 git config --add remote.origin.push "+refs/heads/master:refs/heads/master"
102 ################################################################################
103 # Section 2: Debian packaging
104 ################################################################################
109 # Copy over the changelog because we expect it to be locally modified in the
111 cp "${STARTDIR}/debian/changelog" i3/debian/changelog
112 (cd i3 && git add debian/changelog && git commit -m 'Update debian/changelog')
114 cat > ${TMPDIR}/Dockerfile <<EOT
116 RUN sed -i 's,^deb \(.*\),deb \1\ndeb-src \1,g' /etc/apt/sources.list
117 RUN apt-get update && apt-get install -y dpkg-dev devscripts
118 COPY i3/i3-${RELEASE_VERSION}.tar.bz2 /usr/src/i3-wm_${RELEASE_VERSION}.orig.tar.bz2
120 RUN tar xf i3-wm_${RELEASE_VERSION}.orig.tar.bz2
121 WORKDIR /usr/src/i3-${RELEASE_VERSION}
122 COPY i3/debian /usr/src/i3-${RELEASE_VERSION}/debian/
123 RUN mkdir debian/source
124 RUN echo '3.0 (quilt)' > debian/source/format
126 RUN mk-build-deps --install --remove --tool 'apt-get --no-install-recommends -y' i3-${RELEASE_VERSION}/debian/control
127 WORKDIR /usr/src/i3-${RELEASE_VERSION}
128 RUN dpkg-buildpackage -sa -j8
129 RUN dpkg-buildpackage -S -sa -j8
132 CONTAINER_NAME=$(echo "i3-${TMPDIR}" | sed 's,/,,g')
134 for file in $(docker run --name "${CONTAINER_NAME}" i3 /bin/sh -c "ls /usr/src/i3*_${RELEASE_VERSION}*")
136 docker cp "${CONTAINER_NAME}:${file}" ${TMPDIR}/debian/
139 echo "Content of resulting package’s .changes file:"
140 cat ${TMPDIR}/debian/*.changes
142 # debsign is in devscripts, which is available in fedora and debian
143 debsign --no-re-sign -k4AC8EE1D ${TMPDIR}/debian/*.changes
145 # TODO: docker cleanup
147 ################################################################################
149 ################################################################################
151 # Ensure we are in the correct branch for copying the docs.
153 git checkout ${RELEASE_BRANCH}
156 git clone --quiet ${STARTDIR}/../i3.github.io
159 mkdir docs/${PREVIOUS_VERSION}
160 tar cf - '--exclude=[0-9]\.[0-9e]*' docs | tar xf - --strip-components=1 -C docs/${PREVIOUS_VERSION}
161 git add docs/${PREVIOUS_VERSION}
162 git commit -a -m "save docs for ${PREVIOUS_VERSION}"
164 cp ${TMPDIR}/i3/i3-${RELEASE_VERSION}.tar.bz2* downloads/
165 git add downloads/i3-${RELEASE_VERSION}.tar.bz2*
166 cp ${TMPDIR}/i3/RELEASE-NOTES-${RELEASE_VERSION} downloads/RELEASE-NOTES-${RELEASE_VERSION}.txt
167 git add downloads/RELEASE-NOTES-${RELEASE_VERSION}.txt
168 sed -i "s,<h2>Documentation for i3 v[^<]*</h2>,<h2>Documentation for i3 v${RELEASE_VERSION}</h2>,g" docs/index.html
169 sed -i "s,<span style=\"margin-left: 2em; color: #c0c0c0\">[^<]*</span>,<span style=\"margin-left: 2em; color: #c0c0c0\">${RELEASE_VERSION}</span>,g" index.html
170 sed -i "s,The current stable version is .*$,The current stable version is ${RELEASE_VERSION}.,g" downloads/index.html
171 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>$(LC_ALL=en_US.UTF-8 ls -lh ../i3/i3-${RELEASE_VERSION}.tar.bz2 | awk -F " " {'print $5'} | sed 's/K$/ KiB/g' | sed 's/M$/ MiB/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
173 git commit -a -m "add ${RELEASE_VERSION} release"
175 for i in $(find _docs -maxdepth 1 -and -type f -and \! -regex ".*\.\(html\|man\)$" -and \! -name "Makefile")
177 base="$(basename $i)"
178 [ -e "${TMPDIR}/i3/docs/${base}" ] && cp "${TMPDIR}/i3/docs/${base}" "_docs/${base}"
181 sed -i "s,Verify you are using i3 ≥ .*,Verify you are using i3 ≥ ${RELEASE_VERSION},g" _docs/debugging
185 for i in $(find _docs -maxdepth 1 -and -type f -and \! -regex ".*\.\(html\|man\)$" -and \! -name "Makefile")
187 base="$(basename $i)"
188 [ -e "${TMPDIR}/i3/docs/${base}" ] && cp "_docs/${base}.html" docs/
191 git commit -a -m "update docs for ${RELEASE_VERSION}"
193 git remote remove origin
194 git remote add origin git@github.com:i3/i3.github.io.git
195 git config --add remote.origin.push "+refs/heads/master:refs/heads/master"
197 ################################################################################
198 # Section 4: prepare release announcement email
199 ################################################################################
203 From: Michael Stapelberg <michael@i3wm.org>
204 To: i3-announce@freelists.org
205 Subject: i3 v${RELEASE_VERSION} released
206 Content-Type: text/plain; charset=utf-8
207 Content-Transfer-Encoding: 8bit
211 I just released i3 v${RELEASE_VERSION}. Release notes follow:
213 cat ${TMPDIR}/i3/RELEASE-NOTES-${RELEASE_VERSION} >>email.txt
215 ################################################################################
216 # Section 5: final push instructions
217 ################################################################################
219 echo "As a final sanity check, install the debian package and see whether i3 works."
221 echo "When satisfied, run:"
222 echo " cd ${TMPDIR}/i3"
223 echo " git checkout next"
224 echo " vi debian/changelog"
225 echo " git commit -a -m \"debian: update changelog\""
228 echo " cd ${TMPDIR}/i3.github.io"
231 echo " cd ${TMPDIR}/debian"
235 echo " sendmail -t < email.txt"
237 echo "Update milestones on GitHub (only for new major versions):"
238 echo " Set due date of ${RELEASE_VERSION} to $(date +'%Y-%m-%d') and close the milestone"
239 echo " Create milestone for the next major version with unset due date"
245 echo " reddit /r/i3wm"