forked from maplestory-music/maplebgm-db
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy.sh
executable file
·32 lines (27 loc) · 879 Bytes
/
deploy.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/sh
setup_git() {
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
}
git_commit() {
git checkout --orphan prod
timestamp=$(date "+%b %d %Y")
git add bgm.min.json
git add playlist.min.json
git commit -m "GitHub Actions: $timestamp (Build $GITHUB_RUN_NUMBER)"
}
git_push() {
git remote rm origin
git remote add origin https://${GITHUB_TOKEN}@github.com/maplestory-music/maplebgm-db.git > /dev/null 2>&1
git push origin prod --force --quiet > /dev/null 2>&1
}
setup_git
changed=$(git diff --name-only HEAD~1 HEAD | grep -E "bgm/|locale/|playlist/" | wc -l)
if [ $changed -ne 0 ]; then
echo "Change in files detected. Merging and pushing to prod branch..."
yarn merge
git_commit
git_push
else
echo "No change in files"
fi