Tested with `ghc-8.10.5` and `cabal-install 3.4.0.0`.

When releasing a release candidate (RC) the following procedure can be
followed:

* Verify that the Travis builds and GitHub workflows have no errors.

* Finish the release notes in the CHANGELOG.

* Run the `closed-issues-for-milestone` program for adding the list of
  closed issues to the CHANGELOG.

* Because some titles of some issues can generate new white-space
  issues after running the `closed-issues-for-milestone` program, run

    make check-whitespace

  and fix the issues both in the CHANGELOG file and GitHub.

* Update the README.md, if necessary.

* Update the list of contributors if necessary.

  Note: This is duplicated in the following locations:

  - Agda.cabal
  - doc/user-manual/conf.py
  - doc/user-manual/team.rst
  - LICENSE

* Update the LICENSE file, if necessary.

* Update Stackage resolvers, if necessary.

* Update the copyright year range in

  - Agda.cabal
  - /doc/user-manual/conf.py
  - LICENSE

* Get a clean Agda repository.

    MAJORVERSION=<current-development-version-eg-2.4.2>
    VERSION=<current-released-version-eg-2.4.0.2>
    git clone git@github.com:agda/agda.git agda-release
    cd agda-release
    git checkout master

* Create the branch used for the release

    git checkout -b release-$MAJORVERSION

* The version of the RC is $VERSION + current date

    RC_VERSION=<current-released-version-current-date-eg-2.4.0.2.20150913>

* Update the Agda version

    ./src/release-tools/change-version.bash VERSION RC_VERSION

* Obtain and install the standard library branch related to the Agda:

    make up-to-date-std-lib

* Obtain and install the cubical library branch related to the Agda:

    make up-to-date-cubical

* Run the test-suite:

    make compile-emacs-mode
    make test

  Note that "compile-emacs-mode" invokes "agda-mode compile", which should
  ensure that the Emacs mode can be compiled without errors or
  warnings (except for the "cl package required at runtime" warning).

1) Remove the Cabal test-suite from Agda.cabal.

2) Remove -Werror and -fprof-auto from Agda.cabal (this is required by
  `cabal --check`).

3) Removed unnecessary dependencies from stack-XYZ.yaml files:

  + Removed QuickCheck dependency
  + Removed tasty-* dependencies
  + Removed local package (src/size-solver)

4) Added to the extra-source-files field in Agda.cabal the file (see
  Issues #4216):

    doc/user-manual.pdf

* Update the user manual:

    make user-manual-pdf

* Build source distributions:

    cabal configure
    cabal check
    cabal sdist

* Build documentation for uploading to Hackage.

    cabal haddock --haddock-for-hackage

* Ensure that the package builds properly (with multiple versions of
  GHC if possible) in Linux, macOS and Windows.

    BASE=`pwd`
    cd ${TMPDIR:-/tmp}
    tar xzf $BASE/dist-newstyle/sdist/Agda-$RC_VERSION.tar.gz
    cd Agda-$RC_VERSION
    cabal install --program-suffix=-$RC_VERSION
    agda-$RC_VERSION --version
    agda-mode-$RC_VERSION compile

* Tag the release candidate (do not forget to record the changes above
  first):

    cd $BASE
    git tag -a v$RC_VERSION -m "Agda $MAJORVERSION release candidate"

* Upload the tarball and the documentation to Hackage of the RC:

    cd $BASE
    cabal upload dist-newstyle/sdist/Agda-$RC_VERSION.tar.gz
    cabal upload -d dist-newstyle/Agda-$RC_VERSION-docs.tar.gz

* Revert changes made in 1), 2), 3) and 4).

* Restore the Agda version

    ./src/release-tools/change-version.bash RC_VERSION VERSION

* Push all changes (in the release-$MAJORVERSION branch):

    git push --set-upstream --follow-tags

* Announce the release candidate on the Agda mailing lists (users and
  developers).
