How to optimize phi damping parameter in trend component of the exponential smoothing state space ETS function of fable package time-series forecasting model?

It may help to think of this abstractly.

1.Choose a metric to measure the model, such as AIC
2. Apply the model multiple times varying the phi or phi-range argument to the trend() part of ETS
3. Select the model with the lowest AIC (for example)
4. Choose a metric, such as RMSE to evaluate the fit against the test set
5. Repeat with the next best AIC to see whether the fit is as good, better or worse