adding a post-update hook example

This commit is contained in:
Brian 2022-02-07 15:15:40 -07:00
parent b97b438c52
commit 23bc69b8c7
Signed by: brian
GPG Key ID: DE1A5390A3B84CD8

15
hooks/local/post-update Normal file
View File

@ -0,0 +1,15 @@
#!/usr/bin/env bash
GIT_TAG=$(git tag --points-at HEAD)
if [ -n "$GIT_TAG" ]; then
sed -i "/^GIT_TAG=\".*\"/ s//GIT_TAG=\"${GIT_TAG}\"/" .env
else
sed -i "/^GIT_TAG=\".*\"/ s//GIT_TAG=\"\"/" .env
fi
GIT_BRANCH=$(git branch --show-current)
if [ -n "$GIT_BRANCH" ]; then
sed -i "/^GIT_BRANCH=\".*\"/ s//GIT_BRANCH=\"${GIT_BRANCH}\"/" .env
else
sed -i "/^GIT_BRANCH=\".*\"/ s//GIT_BRANCH=\"\"/" .env
fi