These are some useful git commands for implementing this in your own deployment setup.
Detecting if we're running on a clean checkout:
- git fetch
- git diff --shortstat [branch]
Determining if there are pending migrations:
- git diff --shortstat [last_tag] [branch] db/migrate
Displaying new migrations in list form:
- git diff --summary [last_tag] [branch] db/migrate
Adding new tags (you want to annotate your tags):
- git tag -a [new_tag] -m "annotation for tag"
- git push --tags
Deleting a tag:
- git tag -d [tag]
- git push --tags