Viable inflationary models ending with a first-order phase transition