Create 4220088080.yml (#155) #202
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Generator | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- '.github/workflows/generator.yml' | |
- 'script/generator.py' | |
- 'script/iplist.py' | |
- 'as/**' | |
workflow_dispatch: | |
concurrency: | |
group: generator | |
cancel-in-progress: true | |
jobs: | |
generator: | |
runs-on: ubuntu-latest | |
name: Generator | |
steps: | |
- name: Setup Python Environment | |
uses: actions/setup-python@main | |
with: | |
python-version: "3.10" | |
- name: Checkout Code | |
uses: actions/checkout@main | |
with: | |
token: ${{ secrets.GH_TOKEN }} | |
- name: Get Old Zone File | |
uses: actions/checkout@main | |
with: | |
token: ${{ secrets.GH_TOKEN }} | |
repository: dn-11/metadata | |
path: metadata.old | |
sparse-checkout: | | |
dn11.zone | |
dn11-rdns.zone | |
sparse-checkout-cone-mode: false | |
- name: Run Generator | |
run: | | |
pip3 install pyyaml IPy py-markdown-table requests | |
python3 script/generator.py | |
- name: Upload Metadata to GitHub | |
run: | | |
cd metadata | |
mv monitor-metadata.json .. | |
git init | |
git config --global user.name "GitHub Action" | |
git config --global user.email "[email protected]" | |
git add * | |
git commit -m "Sync" | |
git branch -M main | |
git remote add origin https://${{ secrets.GH_TOKEN }}@github.com/dn-11/metadata.git | |
git push --force -u origin main | |
- name: Prepare for COS Upload | |
run: | | |
cd metadata | |
rm -rf .git README.md | |
mv ../monitor-metadata.json . | |
- name: Upload Monitor-Metadata to COS | |
timeout-minutes: 5 | |
uses: TencentCloud/cos-action@v1 | |
with: | |
secret_id: ${{ secrets.TENCENT_CLOUD_SECRET_ID }} | |
secret_key: ${{ secrets.TENCENT_CLOUD_SECRET_KEY }} | |
cos_bucket: ${{ secrets.COS_BUCKET }} | |
cos_region: ${{ secrets.COS_REGION }} | |
local_path: 'metadata' | |
remote_path: '' | |
clean: false |