Scotland’s Finance Secretary has announced she will not stand for re-election next year after more than a quarter of a century at Holyrood.