-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Provide deploy.sh script for deployments #3741
- Loading branch information
Showing
3 changed files
with
67 additions
and
0 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,45 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
echo "--------------------------------" | ||
echo "Deployment of SecHub scan action" | ||
echo "--------------------------------" | ||
echo "[SETUP]" | ||
npm install | ||
|
||
echo "[BUILD]" | ||
npm run build | ||
|
||
echo "[TEST]" | ||
npm run test | ||
|
||
# Check for any changes in the repository | ||
changed_files=$(git diff --name-only HEAD) | ||
|
||
# Check if there are no changes | ||
if [ -z "$changed_files" ]; then | ||
echo "No changes detected in the repository." | ||
echo "[CANCELED]" | ||
|
||
exit 5 | ||
fi | ||
|
||
# Check if the only changed file is index.js | ||
if [ "$changed_files" != "index.js" ]; then | ||
echo "Changes detected in files other than index.js (only):" | ||
echo "$changed_files" | ||
echo "" | ||
echo "This may not happen on a deployment! Check the other changes" | ||
echo "[FAILED]" | ||
exit 1 | ||
fi | ||
echo "Only index.js has changes, deployment is possible." | ||
echo "[DEPLOY]" | ||
|
||
git add --all | ||
git commit -m "GitHub action (scan) deployment" | ||
git push | ||
|
||
|
||
|
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