This commit is contained in:
@@ -1,44 +1,20 @@
|
|||||||
name: Sync Source
|
name: Pull develop branch
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
|
||||||
- develop
|
- develop
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
sync-source:
|
sync:
|
||||||
runs-on: ubuntu-latest
|
runs-on: docker
|
||||||
container:
|
|
||||||
volumes:
|
|
||||||
- /data:/data
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- name: Checkout develop branch
|
||||||
- name: Debug
|
uses: actions/checkout@v3
|
||||||
run: |
|
with:
|
||||||
pwd
|
ref: develop
|
||||||
ls -la /
|
|
||||||
ls -la /data
|
|
||||||
|
|
||||||
- name: Show mount
|
- name: Copy source to host
|
||||||
run: |
|
run: |
|
||||||
mount | grep data
|
rm -rf /workspace/*
|
||||||
df -h
|
cp -r $GITHUB_WORKSPACE/* /workspace/
|
||||||
ls -la /data
|
|
||||||
|
|
||||||
- name: Clone or Pull
|
|
||||||
env:
|
|
||||||
REPO_URL: https://gitea.digitoolsolutions.synology.me/lamtruong28/Test.git
|
|
||||||
TARGET_DIR: /data/Test
|
|
||||||
BRANCH: develop
|
|
||||||
run: |
|
|
||||||
if [ ! -d "$TARGET_DIR/.git" ]; then
|
|
||||||
echo "Repository does not exist. Cloning..."
|
|
||||||
git clone -b $BRANCH $REPO_URL $TARGET_DIR
|
|
||||||
else
|
|
||||||
echo "Repository already exists. Pulling..."
|
|
||||||
git -C $TARGET_DIR fetch origin
|
|
||||||
git -C $TARGET_DIR checkout $BRANCH
|
|
||||||
git -C $TARGET_DIR reset --hard origin/$BRANCH
|
|
||||||
fi
|
|
||||||
|
|||||||
Reference in New Issue
Block a user