修复输出错误 #11
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: Compile Sketch | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
permissions: | |
contents: write | |
jobs: | |
compress: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout main Branch | |
uses: actions/checkout@v4 | |
with: | |
ref: main | |
path: main | |
- name: Checkout compressed Branch | |
uses: actions/checkout@v4 | |
with: | |
ref: compressed | |
path: compressed | |
- name: Compress | |
run: | | |
cd main/web-pages || exit 1 | |
gzip -rf . | |
- name: Clean up compressed Branch | |
run: | | |
cd compressed || exit 1 | |
rm -rf web-pages | |
rm -rf compressed | |
mkdir -p compressed | |
- name: Copy compressed files | |
run: | | |
cp -rf main/web-pages/*.gz compressed/compressed | |
- name: Remove commits and Push | |
run: | | |
cd compressed || exit 1 | |
git config user.name 'github-actions[bot]' | |
git config user.email 'github-actions[bot]@users.noreply.github.com' | |
git checkout --orphan latest_branch | |
git add -A | |
git commit -am "Compress files" | |
git branch -D compressed | |
git branch -m compressed | |
git push -f origin compressed | |
- name: Get commit SHA | |
id: get-sha | |
run: | | |
cd main || exit 1 | |
echo "sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT" | |
- name: Update web-controller in Cookie-Cats | |
uses: peter-evans/repository-dispatch@v2 | |
with: | |
token: ${{ secrets.WEBHOOK_SECRET }} | |
repository: Cookie-Cats/Cookie-Cats | |
event-type: update | |
client-payload: '{"commit_id": "${{ steps.get-sha.outputs.sha }}"}' |