Start by going to your custom melee attack montage and opening it. If you do not know how to create a montage find the attack animation you want to use and right click on it in the content browser and select Create Anim Montage.

Once in your montage first set the Slot to DefaultGroup.FireWeapon this is shown in the image below.

Montage UI for UE 4.24 or older
Montage UI for UE 4.25 or newer

Next you need to go to your custom melee attack animation and add the Melee Swing Start notify like in the image below, you can do this by right clicking the Notifies bar then to Add Notify and select the Melee Swing Start option.

Animation UI for UE 4.24 or older
Animation UI for UE 4.25 or newer

You need to position this notify at the point in the animation that you want the damage trace to start (This is when the weapon can deal damage).

When in the animation you also should make sure that Enable RootMotion is Disabled as SGK is not setup to use root motion and having this enable will stop the animation from playing.

Once this is done you can go to your melee weapons holdable blueprint and search for Melee Animations in the class defaults there you can set your new montage.