generated from ministryofjustice/template-repository
-
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.
PI-2628 Only run deploy action for projects that are enabled
- Loading branch information
1 parent
2042868
commit 2fa3f41
Showing
3 changed files
with
53 additions
and
6 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,21 @@ | ||
#!/usr/bin/env bash | ||
|
||
function fromJsonArray() { | ||
jq --raw-output '.[]' | ||
} | ||
|
||
function toJsonArray() { | ||
jq --raw-input . | jq --slurp --compact-output . | ||
} | ||
|
||
function deploymentEnabled() { | ||
env=$1 | ||
while IFS= read -r project; do | ||
file="projects/$project/deploy/values-$env.yml" | ||
if [ -f "$file" ] && ! grep -q 'enabled: false' "$file"; then echo "$project"; fi | ||
done | ||
} | ||
|
||
echo "dev=$(echo -n "$PROJECTS" | fromJsonArray | deploymentEnabled dev | toJsonArray)" | tee -a "$GITHUB_OUTPUT" | ||
echo "prepod=$(echo -n "$PROJECTS" | fromJsonArray | deploymentEnabled preprod | toJsonArray)" | tee -a "$GITHUB_OUTPUT" | ||
echo "prod=$(echo -n "$PROJECTS" | fromJsonArray | deploymentEnabled prod | toJsonArray)" | tee -a "$GITHUB_OUTPUT" |
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