feat(CI): add commit hashes to the automatic SQL import (#1516)
This commit is contained in:
+2
-2
@@ -24,12 +24,12 @@ before_install:
|
|||||||
- git config user.email "azerothcorebot@gmail.com" && git config user.name "AzerothCoreBot"
|
- git config user.email "azerothcorebot@gmail.com" && git config user.name "AzerothCoreBot"
|
||||||
- if [ "$TRAVIS_BUILD_ID" = "1" ] && [ "$TRAVIS_PULL_REQUEST" = "false" ]; then cd bin/; fi
|
- if [ "$TRAVIS_BUILD_ID" = "1" ] && [ "$TRAVIS_PULL_REQUEST" = "false" ]; then cd bin/; fi
|
||||||
# import pending sql
|
# import pending sql
|
||||||
- if [ "$TRAVIS_BUILD_ID" = "1" ] && [ "$TRAVIS_PULL_REQUEST" = "false" ] && [ "$TRAVIS_BRANCH" = "master" ]; then bash acore-db-pendings; fi
|
- if [ "$TRAVIS_BUILD_ID" = "1" ] && [ "$TRAVIS_PULL_REQUEST" = "false" ] && [ "$TRAVIS_BRANCH" = "master" ]; then source acore-db-pendings; fi
|
||||||
- if [ "$TRAVIS_BUILD_ID" = "1" ] && [ "$TRAVIS_PULL_REQUEST" = "false" ]; then cd ..; fi
|
- if [ "$TRAVIS_BUILD_ID" = "1" ] && [ "$TRAVIS_PULL_REQUEST" = "false" ]; then cd ..; fi
|
||||||
# push changes to git if any
|
# push changes to git if any
|
||||||
- if [ "$TRAVIS_BUILD_ID" = "1" ] && [ "$TRAVIS_PULL_REQUEST" = "false" ]; then git fetch --unshallow; fi
|
- if [ "$TRAVIS_BUILD_ID" = "1" ] && [ "$TRAVIS_PULL_REQUEST" = "false" ]; then git fetch --unshallow; fi
|
||||||
- if [ "$TRAVIS_BUILD_ID" = "1" ] && [ "$TRAVIS_PULL_REQUEST" = "false" ]; then git checkout $TRAVIS_BRANCH; fi
|
- if [ "$TRAVIS_BUILD_ID" = "1" ] && [ "$TRAVIS_PULL_REQUEST" = "false" ]; then git checkout $TRAVIS_BRANCH; fi
|
||||||
- if [ "$TRAVIS_BUILD_ID" = "1" ] && [ "$TRAVIS_PULL_REQUEST" = "false" ] && [[ -n "$GITHUB_API_KEY" ]]; then git add -A . && git diff --cached --quiet || git commit -am "Import pending SQL update file" && git push https://$GITHUB_API_KEY@github.com/$TRAVIS_REPO_SLUG.git $TRAVIS_BRANCH; fi
|
- if [ "$TRAVIS_BUILD_ID" = "1" ] && [ "$TRAVIS_PULL_REQUEST" = "false" ] && [[ -n "$GITHUB_API_KEY" ]]; then git add -A . && git diff --cached --quiet || git commit -am "Import pending SQL update file..." -m "Referenced commit(s):$COMMIT_HASH" && git push https://$GITHUB_API_KEY@github.com/$TRAVIS_REPO_SLUG.git $TRAVIS_BRANCH; fi
|
||||||
# sync staging with master
|
# sync staging with master
|
||||||
- if [ "$TRAVIS_BUILD_ID" = "1" ] && [ "$TRAVIS_PULL_REQUEST" = "false" ] && [ "$TRAVIS_BRANCH" = "master" ] && [[ -n "$GITHUB_API_KEY" ]]; then git fetch origin staging:staging && git checkout staging && git merge --no-edit master && git push https://$GITHUB_API_KEY@github.com/$TRAVIS_REPO_SLUG.git staging; git checkout master; fi
|
- if [ "$TRAVIS_BUILD_ID" = "1" ] && [ "$TRAVIS_PULL_REQUEST" = "false" ] && [ "$TRAVIS_BRANCH" = "master" ] && [[ -n "$GITHUB_API_KEY" ]]; then git fetch origin staging:staging && git checkout staging && git merge --no-edit master && git push https://$GITHUB_API_KEY@github.com/$TRAVIS_REPO_SLUG.git staging; git checkout master; fi
|
||||||
- source ./apps/ci/ci-before_install.sh
|
- source ./apps/ci/ci-before_install.sh
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ source "$CURRENT_PATH/../bash_shared/includes.sh"
|
|||||||
|
|
||||||
UPDATES_PATH="$AC_PATH_ROOT/data/sql/updates/"
|
UPDATES_PATH="$AC_PATH_ROOT/data/sql/updates/"
|
||||||
|
|
||||||
|
COMMIT_HASH=
|
||||||
|
|
||||||
function import() {
|
function import() {
|
||||||
db=$1
|
db=$1
|
||||||
folder="db_"$db
|
folder="db_"$db
|
||||||
@@ -97,6 +99,13 @@ function import() {
|
|||||||
echo "DROP PROCEDURE IF EXISTS \`updateDb\`;" >> "$newFile";
|
echo "DROP PROCEDURE IF EXISTS \`updateDb\`;" >> "$newFile";
|
||||||
fi;
|
fi;
|
||||||
|
|
||||||
|
currentHash="$(git log --diff-filter=A "$entry" | grep "^commit " | sed -e 's/commit //')"
|
||||||
|
|
||||||
|
if [[ "$COMMIT_HASH" != *"$currentHash"* ]]
|
||||||
|
then
|
||||||
|
COMMIT_HASH="$COMMIT_HASH $currentHash"
|
||||||
|
fi
|
||||||
|
|
||||||
rm $entry;
|
rm $entry;
|
||||||
|
|
||||||
oldDate=$dateToday
|
oldDate=$dateToday
|
||||||
|
|||||||
Reference in New Issue
Block a user