Merge pull request #1 from wxl0430/master

feat: 实现双服务器更新
This commit is contained in:
denglihong2007
2025-07-20 09:56:44 +08:00
committed by GitHub
2 changed files with 58 additions and 44 deletions

View File

@@ -1,26 +1,28 @@
name: Deploy
on:
push:
branches: [ master ]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install dependencies
run: |
pip install requests
pip install pyyaml
- name: Run deploy script
env:
DEPLOY_URL: ${{ secrets.DEPLOY_URL }}
DEPLOY_TOKEN: ${{ secrets.DEPLOY_TOKEN }}
run: |
python tools/MakePackage.py
python tools/PostPackage.py
name: Deploy
on:
push:
branches: [ master ]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install dependencies
run: |
pip install requests
pip install pyyaml
- name: Run deploy script
env:
DEPLOY_URL: ${{ secrets.DEPLOY_URL }}
DEPLOY_TOKEN: ${{ secrets.DEPLOY_TOKEN }}
MIRROR_DEPLOY_URL: ${{ secrets.MIRROR_DEPLOY_URL }}
MIRROR_DEPLOY_TOKEN: ${{ secrets.MIRROR_DEPLOY_TOKEN }}
run: |
python tools/MakePackage.py
python tools/PostPackage.py

View File

@@ -1,18 +1,30 @@
import requests
import os
parent_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
zip_path = os.path.join(parent_dir, 'output.zip')
url = os.environ['DEPLOY_URL']
token = os.environ.get('DEPLOY_TOKEN', '')
with open(zip_path, 'rb') as f:
r = requests.post(
url,
files={'file': f},
headers={'Authorization': f'Bearer {token}'}
)
print(f"Server responded with status: {r.status_code}")
print(r.text)
import requests
import os
parent_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
zip_path = os.path.join(parent_dir, 'output.zip')
url = os.environ['DEPLOY_URL']
token = os.environ.get('DEPLOY_TOKEN', '')
mirror_url = os.environ['MIRROR_DEPLOY_URL']
mirror_token = os.environ.get('MIRROR_DEPLOY_TOKEN', '')
with open(zip_path, 'rb') as f:
r = requests.post(
url,
files={'file': f},
headers={'Authorization': f'Bearer {token}'}
)
with open(zip_path, 'rb') as f:
mirror_r = requests.post(
mirror_url,
files={'file': f},
headers={'Authorization': f'Bearer {mirror_token}'}
)
print(f"Server responded with status: {r.status_code}")
print(r.text)
print(f"Mirror server responded with status: {mirror_r.status_code}")
print(mirror_r.text)