Hi Khalil,
As already explained by others a timer is the way to implement this. To avoid that the timer runs on every 1CP you can use a site property that you set to true during the deploy to the next environment.
If you want to run some code after a complete deployment, then you can only do that by running a second deployment of an application that will do the code you want to run on deploy.
Unfortunately Lifetime has no hooks available to add logic to, the way you want it.
Regards,
Daniel