Skip to content

Sync with upstream

Sync with upstream #24

Workflow file for this run

name: Sync with upstream
on:
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
jobs:
sync:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Configure Git
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
# Sync Openclash stable
- name: Sync Openclash stable
run: |
git clone --depth 1 -b master https://github.com/vernesong/OpenClash.git temp_stable
rsync -av --exclude='.git' --exclude-from=.syncignore temp_stable/ "Openclash stable/"
rm -rf temp_stable
# Hapus file-file yang tidak diinginkan secara eksplisit
rm -rf "Openclash stable/.github"
rm -f "Openclash stable/LICENSE"
rm -f "Openclash stable/README.md"
# Tambahkan perintah rm lain sesuai kebutuhan
git add "Openclash stable"
git commit -m "Sync Openclash stable with upstream master" || echo "No changes to commit"
# Sync Openclash dev
- name: Sync Openclash dev
run: |
git clone --depth 1 -b dev https://github.com/vernesong/OpenClash.git temp_dev
rsync -av --exclude='.git' --exclude-from=.syncignore temp_dev/ "Openclash dev/"
rm -rf temp_dev
# Hapus file-file yang tidak diinginkan secara eksplisit
rm -rf "Openclash dev/.github"
rm -f "Openclash dev/LICENSE"
rm -f "Openclash dev/README.md"
# Tambahkan perintah rm lain sesuai kebutuhan
git add "Openclash dev"
git commit -m "Sync Openclash dev with upstream dev" || echo "No changes to commit"
# Sync Openclash core
- name: Sync Openclash core
run: |
git clone --depth 1 -b core https://github.com/vernesong/OpenClash.git temp_core
rsync -av --delete --exclude='.git' --exclude-from=.syncignore temp_core/ "Openclash core/"
rm -rf temp_core
git add "Openclash core"
git commit -m "Sync Openclash core with upstream" || echo "No changes to commit"
# Sync Openclash official package
- name: Sync Openclash official package
run: |
git clone --depth 1 -b package https://github.com/vernesong/OpenClash.git temp_package
rsync -av --delete --exclude='.git' --exclude-from=.syncignore temp_package/ "Openclash official package/"
rm -rf temp_package
git add "Openclash official package"
git commit -m "Sync Openclash official package with upstream" || echo "No changes to commit"
# Update luci-app-openclash in Openclash stable
- name: Update luci-app-openclash in Openclash stable
run: |
if [ -d "Openclash stable/luci-app-openclash" ]; then
rsync -av "Openclash stable/luci-app-openclash/" "Openclash stable/luci-app-openclash/"
git add "Openclash stable/luci-app-openclash"
git commit -m "Update luci-app-openclash in Openclash stable" || echo "No changes to commit"
else
echo "luci-app-openclash directory not found in Openclash stable"
fi
# Update luci-app-openclash in Openclash dev
- name: Update luci-app-openclash in Openclash dev
run: |
if [ -d "Openclash dev/luci-app-openclash" ]; then
rsync -av "Openclash dev/luci-app-openclash/" "Openclash dev/luci-app-openclash/"
git add "Openclash dev/luci-app-openclash"
git commit -m "Update luci-app-openclash in Openclash dev" || echo "No changes to commit"
else
echo "luci-app-openclash directory not found in Openclash dev"
fi
- name: Push changes
run: git push origin main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Update version
run: |
if [ -f "Openclash stable/luci-app-openclash/Makefile" ]; then
MAKEFILE_VERSION=$(grep 'PKG_VERSION:=' "Openclash stable/luci-app-openclash/Makefile" | cut -d'=' -f2)
sed -i "s/versi: .*/versi: $MAKEFILE_VERSION/" README.md
git add README.md
git commit -m "Update versi ke $MAKEFILE_VERSION" || echo "No version changes to commit"
git push origin main
else
echo "Makefile not found"
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}