forked from PhoenicisOrg/phoenicis
-
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.
Update translations with Travis and not during build (PhoenicisOrg#1676)
- Loading branch information
Showing
3 changed files
with
86 additions
and
1 deletion.
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,35 @@ | ||
#!/bin/bash | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "Travis CI" | ||
|
||
head_ref=$(git rev-parse HEAD) | ||
if [[ $? -ne 0 || ! $head_ref ]]; then | ||
echo "could not retrieve HEAD reference" | ||
exit 1 | ||
fi | ||
branch_ref=$(git rev-parse "$TRAVIS_BRANCH") | ||
if [[ $? -ne 0 || ! $branch_ref ]]; then | ||
echo "could not retrieve $TRAVIS_BRANCH reference" | ||
exit 1 | ||
fi | ||
if [[ $head_ref != $branch_ref ]]; then | ||
echo "HEAD ref ($head_ref) does not match $TRAVIS_BRANCH ref ($branch_ref)" | ||
echo "new commits have been added before this build cloned the repository" | ||
exit 0 | ||
fi | ||
if [[ $TRAVIS_BRANCH != master ]]; then | ||
echo "will not push translation updates to branch $TRAVIS_BRANCH" | ||
exit 1 | ||
fi | ||
git checkout master | ||
|
||
# check if anything except "POT creation date" has changed | ||
git diff --numstat i18n/keys.pot | awk '{ if($1 == 1 && $2 == 1) { exit 1 } else exit 0 }' | ||
if [ $? == 0 ]; then | ||
git add *.pot | ||
git commit --message "Update translations" | ||
if ! git push https://$GH_TOKEN@github.com/PhoenicisOrg/phoenicis.git > /dev/null 2>&1; then | ||
echo "could not push translation updates" | ||
exit 1 | ||
fi | ||
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