Former British and Irish Lions and Wales fly-half Dan Biggar has announced he will retire from rugby at the end of the season.