Add rules for baike.baidu.com
#15
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: "minify-and-purge" | |
on: | |
push: | |
branches: | |
- 'core-0.3.x' | |
paths: | |
- '*.json' | |
- '!*.min.json' | |
jobs: | |
minify-and-purge: | |
name: "Minify And Purge" | |
runs-on: "ubuntu-latest" | |
steps: | |
- name: "Checkout Repository" | |
uses: "actions/checkout@v4" | |
- name: "Install Dependencies" | |
run: | | |
python3 -m pip install -r ./.github/scripts/requirements.txt | |
- name: "Minify JSON Files" | |
run: | | |
python3 ./.github/scripts/minify-json.py | |
working-directory: ./ | |
- name: "Detect Changes" | |
id: "detect-changes" | |
run: | | |
if git diff --staged --quiet; then | |
echo "changed=false" >> "$GITHUB_OUTPUT" | |
echo "No changes detected." | |
else | |
echo "changed=true" >> "$GITHUB_OUTPUT" | |
echo "Changes detected." | |
fi | |
- name: "Commit" | |
if: ${{ steps.detect-changes.outputs.changed == 'true' }} | |
run: | | |
git config user.email "[email protected]" | |
git config user.name "GitHub Actions" | |
git commit -m "Minify JSON files." | |
git push origin ${{ github.ref_name }} | |
echo "Changes committed." | |
- name: "Purge jsDelivr Cache" | |
if: ${{ steps.detect-changes.outputs.changed == 'true' }} | |
run: | | |
python3 ./.github/scripts/purge-jsdelivr.py | |
working-directory: ./ |