-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #44 from i-dot-ai/feature/release-infra-workflow
add: release command
- Loading branch information
Showing
4 changed files
with
58 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/bin/bash | ||
# Usage: | ||
## Just pass the name of the env we want to tag and deploy. | ||
## This will create a tag locally with a format of $$ENV-$BRANCH-$CURRENT_USER-$TIMESTAMP | ||
## Then push it to the remote git. | ||
ENV=$1 | ||
BRANCH=$(git rev-parse --abbrev-ref HEAD) | ||
CURRENT_USER=$(whoami) | ||
TIMESTAMP=$(date +%d-%m-%y--%H%M%S) | ||
TAG_NAME="release-$ENV-$BRANCH-$CURRENT_USER-$TIMESTAMP" | ||
|
||
echo "Current branch name is" "$BRANCH" | ||
echo "Current environment name is" "$ENV" | ||
echo "Timestamp assigned will be $TIMESTAMP" | ||
echo "New tag name will be " "$TAG_NAME" | ||
|
||
if [ $ENV == 'prod' ]; then | ||
echo '' | ||
if [ $BRANCH != 'main' ]; then | ||
echo -e "\033[0;31mYou can only deploy to prod through a PR into main\033[0m" | ||
exit 0 | ||
fi | ||
fi | ||
|
||
## | ||
echo "Removing Local tags" | ||
git tag -d $(git tag -l) | ||
|
||
# Command to run | ||
echo "Applying local tag" && \ | ||
git tag "$TAG_NAME" && \ | ||
echo "Pushing tag" && \ | ||
git push origin $TAG_NAME |