ios - when - xcode run shell script

How can I get my build script run phases to run when performing an Archive operation in Xcode 7? (1)

I basically set my build numbers to be the count of Git commits by setting up two build phases that run specific scripts — just like in this question:

Why won't my build phase scripts be executed when creating an IPA from command line?

However, I found that when I Archive either with Xcode or with the fastlane toolchain, the scripts are not invoked.

Why is that? I would have assumed that build gets run when you do an archive. How can I make these build phases run even for the Archive action?

Have you try to open your scheme using Edit scheme..., then expand the Archive Action and add a Post Action ?