Created
August 17, 2022 03:52
-
-
Save vividtone/dc194a69ec18fba0575e4de234932380 to your computer and use it in GitHub Desktop.
Sync scripts for github.com/redmine/redmine
This file contains hidden or 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
#!/bin/bash | |
set -euo pipefail | |
echo "--- BEGIN $(date)" | |
cd $(dirname $0)/redmine-svn | |
git for-each-ref refs/remotes | \ | |
awk '{print $NF}' | \ | |
grep -vE "tags|origin|trunk" | \ | |
grep stable | while read remote; do | |
for gh in github0 github1 github2; do | |
if git config --get-all "remote.$gh.push" | grep -q "$remote:"; then | |
# branch already in config | |
continue | |
fi | |
echo "Missing on $gh: $remote" | |
cmd="git config --add remote.$gh.push $remote:${remote/remotes/heads}" | |
echo " running: $cmd" | |
$cmd | |
done | |
done | |
echo "--- END $(date)" | |
echo |
This file contains hidden or 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
*/5 * * * * ubuntu /home/ubuntu/redmine-mirror/sync.sh 2>&1 | tee -a /home/ubuntu/redmine-mirror/update.log | |
28 * * * * ubuntu /home/ubuntu/redmine-mirror/add-stable-branches.sh 2>&1 | tee -a /home/ubuntu/redmine-mirror/branches.log |
This file contains hidden or 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
#!/bin/bash | |
echo "--- BEGIN $(date)" | |
cd $(dirname $0)/redmine-svn | |
git svn fetch --all | |
git for-each-ref refs/remotes/tags | cut -d / -f 4- | while read ref; do | |
if test -z "$(git tag -l $ref)"; then | |
git tag -a "$ref" -m "tagged version $ref" "refs/remotes/tags/$ref" | |
fi | |
done | |
#git push github0 | |
git push github1 | |
#svn metadata | |
echo "--- END $(date)" | |
echo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment