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

* Clone the standard library
    git clone git@github.com:Agda/agda-stdlib std-lib

* 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
    autoconf
    ./configure
    make install CABAL_OPTIONS="--prefix=$PWD/usr"
    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:

  ** Update the Download page:

     *** Move the current version information to the old releases
         section.

     *** Update the last release information.

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

  ** If necessary, update the Standard Library page.

  ** Update the Main page.

* Release the standard library:

  cd std-lib
  git tag v$VERSION
  git push --tags

* Update the Standard Library page on the wiki.

* 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) in:

  Agda.cabal (twice),
  src/data/emacs-mode/agda2-mode.el and
  mk/paths.mk.

* 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
