-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extract the deploy logic into a separate bash script to make it more …
…readable
- Loading branch information
Torbjørn Vatn
committed
Apr 27, 2021
1 parent
105fe43
commit 59d8abd
Showing
2 changed files
with
25 additions
and
9 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/usr/bin/env bash | ||
|
||
environment=$1 | ||
auto_merge=$2 | ||
task=$3 | ||
|
||
if git fetch && git diff @"{push}" --shortstat --exit-code > /dev/null 2>&1; then | ||
# Trigger the deployment event | ||
gh api repos/:owner/:repo/deployments -H "Accept: application/vnd.github.ant-man-preview+json" \ | ||
--method POST -F ref=":branch" -F environment="$environment" -F auto_merge="$auto_merge" \ | ||
-F task="$task" | ||
|
||
echo "Looking for active runs..." && sleep 5 | ||
|
||
# List all runs for current branch | ||
branch=$(git branch --show-current) | ||
run_id=$(gh run list --limit 1 | grep "$branch" | grep -v "completed" | rev | cut -f1 | rev) | ||
gh run watch "$run_id" | ||
else | ||
echo "There is a git diff ⤴️ or no remote branch, exiting..." | ||
fi; |
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