update meta #14
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: update app-meta.json | |
on: | |
push: | |
branches: | |
- master | |
paths: | |
- 'app-meta.json' | |
- '.github/workflows/app-meta-update.yml' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set variables | |
run: | | |
echo "app_meta=https://raw.githubusercontent.com/LuckyPray/XAutoDaily/master/app-meta.json" >> $GITHUB_ENV | |
- name: Clone pages branch | |
uses: actions/[email protected] | |
with: | |
ref: pages | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- name: Update app-meta.json | |
run: | | |
curl -sSL ${app_meta} > app-meta.json | |
git config --global user.name 'github-actions[bot]' | |
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
python generate.py | |
git add . | |
if [[ -n $(git status -s) ]]; then | |
git commit -m "Update app-meta.json" | |
git push "https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}" pages:pages | |
fi | |
- name: Purge jsdelivr CDN | |
run: | | |
for file in $(ls); do | |
curl -i "https://purge.jsdelivr.net/gh/${{ github.repository }}@pages/${file}" | |
done |