-
Notifications
You must be signed in to change notification settings - Fork 5
60 lines (54 loc) · 1.9 KB
/
deploy.yml
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
name: Deploy website and admin panel
on:
push:
branches:
- main
jobs:
merge:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Fetch and reset main branch
run: |
git fetch origin main
git checkout main
git reset --hard origin/main
- name: Merge website branch to website-main
run: |
git fetch origin
git config user.name github-actions
git config user.email [email protected]
if [ "$(git diff origin/main:website origin/website-main | wc -l)" -gt "0" ]; then
echo "Detected uncommitted changes in the website folder after build. Pushing changes to website-main branch."
git checkout website-main
git rm -r *
git checkout main -- website
git mv website/* .
ls
rm -r website
git add .
git commit -m "Deploy website"
git push origin website-main
else
echo "No changes detected in the website folder after build. Exiting."
fi
- name: Merge admin branch to admin-main
run: |
git fetch origin
git config user.name github-actions
git config user.email [email protected]
if [ "$(git diff origin/main:admin origin/admin-main | wc -l)" -gt "0" ]; then
echo "Detected uncommitted changes in the admin folder after build. Pushing changes to admin-main branch."
git checkout admin-main
git rm -r *
git checkout main -- admin
git mv admin/* .
ls
rm -r admin
git add .
git commit -m "Deploy admin panel"
git push origin admin-main
else
echo "No changes detected in the admin folder after build. Exiting."
fi