2024-11-28 16:48:38 +08:00
|
|
|
name: Process Apps and Commit Changes
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
2024-11-28 17:49:08 +08:00
|
|
|
- custom
|
2024-11-28 17:06:53 +08:00
|
|
|
pull_request:
|
|
|
|
branches:
|
2024-11-28 17:49:08 +08:00
|
|
|
- custom
|
2024-11-28 16:48:38 +08:00
|
|
|
workflow_dispatch:
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
process:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout code
|
2024-11-28 08:49:55 +00:00
|
|
|
uses: actions/checkout@v4
|
2024-11-28 16:48:38 +08:00
|
|
|
|
|
|
|
- name: Setup Python
|
2024-11-28 09:00:03 +00:00
|
|
|
uses: actions/setup-python@v5
|
2024-11-28 16:48:38 +08:00
|
|
|
with:
|
|
|
|
python-version: '3.10'
|
|
|
|
|
|
|
|
- name: Install dependencies
|
|
|
|
run: |
|
|
|
|
python -m pip install --upgrade pip
|
|
|
|
pip install pyyaml
|
|
|
|
|
|
|
|
- name: Run processing script
|
|
|
|
run: python process-apps.py
|
|
|
|
|
2024-11-28 16:59:01 +08:00
|
|
|
- name: Verify generated directories
|
2024-11-28 16:48:38 +08:00
|
|
|
run: |
|
2024-11-28 16:59:01 +08:00
|
|
|
ls -R appstore || echo "appstore not created"
|
|
|
|
ls -R dockge || echo "dockge not created"
|
2024-11-28 16:48:38 +08:00
|
|
|
|
|
|
|
- name: Configure Git
|
|
|
|
run: |
|
|
|
|
git config --global user.name "${{ github.actor }}"
|
|
|
|
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
|
|
|
|
|
|
|
|
- name: Commit and push changes
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
run: |
|
2024-11-28 17:49:08 +08:00
|
|
|
git fetch origin custom
|
2024-11-28 23:38:45 +08:00
|
|
|
|
2024-11-28 23:36:06 +08:00
|
|
|
git add .
|
2024-11-28 23:38:45 +08:00
|
|
|
git diff --cached --quiet || git commit -m "Processed apps directory via GitHub Actions"
|
|
|
|
|
|
|
|
git rebase origin/custom || { echo "Rebase failed, trying to resolve"; git rebase --abort; git pull --rebase origin custom; }
|
|
|
|
|
2024-11-28 17:49:08 +08:00
|
|
|
git push origin custom
|
2024-12-04 10:58:29 +08:00
|
|
|
|
|
|
|
- name: Clone DPanel repository
|
|
|
|
run: |
|
2024-12-04 11:40:04 +08:00
|
|
|
git clone https://github.com/QYG2297248353/appstore-dpanel.git target-repo
|
2024-12-04 10:58:29 +08:00
|
|
|
|
|
|
|
- name: Copy appstore to DPanel repository
|
|
|
|
run: |
|
|
|
|
if [ -d "target-repo/apps" ]; then
|
|
|
|
rm -rf target-repo/apps
|
|
|
|
fi
|
|
|
|
mkdir -p target-repo/apps
|
|
|
|
rsync -a appstore/ target-repo/apps/
|
|
|
|
|
|
|
|
- name: Commit and push to DPanel repository
|
|
|
|
working-directory: target-repo
|
|
|
|
env:
|
2024-12-04 11:08:06 +08:00
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUBTOKEN }}
|
2024-12-04 10:58:29 +08:00
|
|
|
run: |
|
|
|
|
git config --global user.name "${{ github.actor }}"
|
|
|
|
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
|
|
|
|
|
|
|
|
git add .
|
|
|
|
git diff --cached --quiet || git commit -m "Synced apps from source repository via GitHub Actions"
|
|
|
|
|
2024-12-04 11:40:04 +08:00
|
|
|
git push https://x-access-token:${{ secrets.GITHUBTOKEN }}@github.com/QYG2297248353/appstore-dpanel.git master
|