Elements heavier than iron are produced mainly by neutron-capture inside stars, although there are other more minor contributors (cosmic ray spallation, radioactive decay). They are not only produced in stars that explode as supernovae. This has now been established fact since the detection of short-lived Technetium in the atmospheres of red giant and AGB stars in the 1950s (e.g. Merrill 1952), and it is tiresome to have to continue correcting this egregious pop-sci claim more than 60 years later.
Neutron capture can occur rapidly (the r-process) and this process occurs mostly inside and during supernova explosions (though other mechanisms such as merging neutron stars have been mooted). The free neutrons are created by electron capture in the final moments of core collapse. At the same time this can lead to the build up of neutron-rich nuclei and the decay products of these lead to many of the chemical elements heavier than iron once they are ejected into the interstellar medium during the supernova explosion. The r-process is almost exclusively responsible for elements heavier than lead and contributes to the abundances of many elements between iron and lead.
There is still ongoing debate about the site of the primary r-process. My judgement from a scan of recent literature is that whilst core-collapse supernovae proponents were in the majority, there is a growing case to be made that neutron star mergers may become more dominant, particularly for the r-process elements with $A>110$ (e.g. Berger et al. 2013; Tsujimoto & Shigeyama 2014). In fact some of the latest research I have found suggests that the pattern of r-process elemental abundances in the solar system could be entirely produced by neutron star mergers (e.g. Wanajo et al. 2004), though models of core-collapse supernovae that incorporate magneto-rotational instabilities also claim to be able to reproduce the solar-system abundance pattern (Nishimura et al. 2017) and may be necessary to explain the enhanced r-process abundances found in some very old halo stars.
The latest word on this debate is the observations of kilonovae and in particular, the spectacular confirmation, in the form of GW170817, that kilonovae can be produced by the merger of two neutron stars. Observations of the presumably neutron-rich ejecta, have confirmed the opacity signature (rapid optical decay, longer IR decay and the appearance of very broad absorption features) that suggest the production of lanthanides and other heavy r-process elements (e.g. Pian et al. 2017; Chornock et al. 2017). Whether neutron star mergers are the dominant source of r-process elements awaits an accurate assessment of how frequently they occur and how much r-process material is produced in each event - both of which are uncertain by factors of a few at least. A paper by Siegel (2019) reviews the merits of neutron star merger vs production of r-process elements in rare types of core collapse supernovae (aka "collapsars"). His conclusion is that collapsars are responsible for the majority of the r-process elements in the Milky Way and that neutron star mergers, whilst probably common enough, do not explain the r-process enhancements seen in some very old halo stars and dwarf galaxies and the falling level of Europium (an r-process element) to Iron with increased iron abundance - (i.e. the Eu behaves like "alpha" elements like Oxygen and Neon that are produced in supernovae).
However, many of the chemical elements heavier than iron are also produced by slow neutron capture; the so-called s-process. The free neutrons for these neutron-capture events come from alpha particle reactions with carbon 13 (inside asymptotic giant branch [AGB] stars with masses of 1-8 solar masses) or neon 22 in giant stars above 10 solar masses. After a neutron capture, a neutron in the new nucleus may then beta decay, thus creating a nucleus with a higher mass number and proton number. A chain of such events can produce a range of heavy nuclei, starting with iron-peak nuclei as seeds. Examples of elements produced mainly in this way include Sr, Y, Rb, Ba, Pb and many others. Proof that this mechanism is effective is seen in the massive overabundances of such elements that are seen in the photospheres of AGB stars. A clincher is the presence of Technetium in the photospheres of some AGB stars, which has a short half life and therefore must have been produced in situ.
According to Pignatari et al. (2010), models suggests that the s-process in high mass stars (that will become supernovae) dominates the s-process production of elements with $A<90$, but for everything else up to and including Lead the s-process elements are mainly produced in modest sized AGB stars that never become supernovae. The processed material is simply expelled into the interstellar medium by mass loss during thermal pulsations during the AGB phase.
As a further addition, just to drive home the point that not all heavy elements are produced by supernovae, here is a plot from the epic review by Wallerstein et al. (1997), which shows the fraction of the heavy elements in the solar system that are produced in the r-process (i.e. an upper limit to what is produced in supernovae explosions). Note that this fraction is very small for some elements (where the s-process dominates), but that the r-process produces everything beyond lead.
A more up-to-date visualisation of what goes on (produced by Jennifer Johnson) and which attempts to identify the sites (as a percentage) for each chemical element is shown below. It should be stressed that the details are still subject to a lot of model-dependent uncertainty.