Please refer to this guide.
If you are using HardHat, use the package at https://www.npmjs.com/package/@nomiclabs/hardhat-etherscan