-
Notifications
You must be signed in to change notification settings - Fork 477
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
40 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
az bicep version 2>/dev/null || az bicep install | ||
|
||
TEMPLATES=() | ||
|
||
for ARG in $@; do | ||
# If the argument is supplied with "-f", then it is a template file that needs to be built | ||
if [[ $ARG == -f=* ]]; then | ||
TEMPLATES+=(${ARG#-f=}) | ||
else | ||
# Otherwise, it is a file that has been edited | ||
az bicep format -f $ARG | ||
git add $ARG | ||
fi | ||
done | ||
|
||
# Build the templates | ||
for TEMPLATE in ${TEMPLATES[@]}; do | ||
az bicep build -f $TEMPLATE | ||
git add "${TEMPLATE%.bicep}.json" # Change the extension from .bicep to .json | ||
done |