When releasing a new version of Agda, the following procedure can be
followed:

* Get a clean Agda repository.

    darcs get http://code.haskell.org/Agda/ Agda.release
    cd Agda.release

* Finish the release notes in
  doc/release-notes/<version-written-with-dashes>.txt.

  Copy the contents of the release notes to the top of the CHANGELOG file.

* Update the README, if necessary.

* Update the LICENSE file, if necessary.

* Update the version numbers in Agda.cabal (twice) and
  src/data/emacs-mode/agda2-mode.el.

* Add a second source-repository section to Agda.cabal:

    source-repository this
      type:     darcs
      location: http://code.haskell.org/Agda/
      tag:      <version>

* Remove -Werror from Agda.cabal.

  (Agda uses code generated by Cabal, Paths_Agda, and under some
  configurations this code gives rise to warnings.)

* Ensure that cabal haddock works:

    cabal configure && cabal haddock

* Ensure that the Emacs mode can be compiled without errors or
  warnings (except for the "cl package required at runtime" warning):

    (cd src/data/emacs-mode && \
      emacs --batch -L . -f batch-byte-compile *.el; \
      rm -f *.elc)

* Tag and build source distributions. (Do not forget to record the
  changes above first.)

    VERSION=<version>
    darcs tag $VERSION
    cabal configure && cabal sdist && cabal check
    cabal install
    darcs dist --dist-name=Agda-$VERSION

* Ensure that all the packages build properly.

    BASE=`pwd`
    cd ${TMPDIR:-/tmp}
    tar xzf $BASE/Agda-$VERSION.tar.gz
    cd Agda-$VERSION
    make install CABAL_OPTIONS="--prefix=$PWD/usr"
    autoconf
    ./configure
    make test
    tar xzf $BASE/dist/Agda-$VERSION.tar.gz
    cd Agda-$VERSION
    cabal install
    cd ..

  Do not forget to test the Emacs mode.

* Upload the Cabal package using cabal upload.

    cd $BASE
    cabal upload dist/Agda-$VERSION.tar.gz

* Upload the darcs tar-ball to code.haskell.org.

    scp Agda-$VERSION.tar.gz code.haskell.org:/srv/code/Agda/

* Update the Agda Wiki:

  ** Add page related to the release notes called

     http://wiki.portal.chalmers.se/agda/pmwiki.php?n=Main.Version-X-Y-Z

  ** Add page related to the README called

     http://wiki.portal.chalmers.se/agda/pmwiki.php?n=Main.README-X-Y-Z

  ** Update the Download page.

  ** Update the Main page.

  ** Update the Release Notes page (under Documentation).

  ** If necessary, update the Standard Library page.

* Announce the release of the new version on the Agda mailing list.

* Update the version numbers again, so that released and development
  versions are not confused, and remove the "this" source-repository
  section from the Cabal file. (This would be unnecessary if we had
  two repositories, one stable and one for development.)

  Remove the release notes for the released version from doc/release-notes.

* Push all changes.

    darcs push
