How do automate a simple fade in/out process?

If you want to have a go at writing a Nyquist plug-in:

This is the basic code for the fade-in:

(setq fade-length 1.5)
(setq end (/ LEN *sound-srate*))

(abs-env
  (mult s (control-srate-abs *sound-srate*
     (pwlv 0 fade-length 1 end 1))))

In this case I’ve set the fade-in length to 1.5 seconds, though it could of course be whatever you like.
You must of course select at least 1.5 seconds of the track or you will not get a complete fade.
The code will process the entire selected region, so rather than selecting a long track and applying it, just select the first few seconds.

The basic code for a fade out is:

(setq fade-length 1.5)
(setq end (/ LEN *sound-srate*))
(setq fade-length (diff end fade-length))

(abs-env 
  (mult s (control-srate-abs *sound-srate*
     (pwlv 1 fade-length 1 end 0.0 ))))

The slightly awkward thing about this is that Nyquist effects run to the end of the selection, not to the end of the audio, so it is important that you select up to exactly the end of the track, if you want the fade-out to be at silence at the end of the track.

Alternatively, you could try this text-envelope effect: https://forum.audacityteam.org/t/text-envelope/14316/1
It is not quite ready for release, but it is fully functional.
As an example, to fade in the first 2.3 seconds of a track and fade out the last 4 seconds, you could select the entire track and use these settings:
Time units = seconds
Amplification units = dB
Initial amplification = -inf
Final amplification = -inf
Intermediate points = 2.3 0 -4 0