-
Notifications
You must be signed in to change notification settings - Fork 0
38 lines (31 loc) · 1.14 KB
/
DemoSync.yaml
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
name: DemoSync
on:
push:
tags:
- '*'
jobs:
sync-folder:
runs-on: ubuntu-latest
steps:
- name: Checkout source repository
uses: actions/checkout@v2
- name: Sync folder and push
run: |
# Configure git
git config --global user.email "[email protected]"
git config --global user.name "Demo Sync"
# Clone the target repository using HTTPS and PAT for authentication
TARGET_REPO="https://x-access-token:${{ secrets.DEMO_REPOSITORY_PAT }}@github.com/diploi/tiny-template-demo.git"
git clone $TARGET_REPO temp_repo
cd temp_repo
# Sync the folder
rsync -av --delete ../initialProject/ ./
# Commit and push the changes, if there are any
git add .
git diff --quiet && git diff --staged --quiet || (git commit -m "Commit sync" && git push origin main)
# Tag and push the tag
TAG_NAME=${GITHUB_REF#refs/tags/}
git tag $TAG_NAME
git push origin --tags
env:
GH_PAT: ${{ secrets.DEMO_REPOSITORY_PAT }}