2021-04-25 11:05:56 +08:00
|
|
|
name: Compress
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches: [main]
|
|
|
|
paths:
|
|
|
|
- "**.jpg"
|
|
|
|
- "**.jpeg"
|
|
|
|
- "**.png"
|
|
|
|
- "**.webp"
|
2021-11-23 14:22:01 +08:00
|
|
|
workflow_dispatch:
|
2021-04-25 11:05:56 +08:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
compress:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
if: github.repository == 'doocs/md'
|
|
|
|
steps:
|
|
|
|
- name: Checkout Branch
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
|
|
|
|
- name: Compress Images
|
2021-11-04 09:41:41 +08:00
|
|
|
id: calibre
|
|
|
|
uses: calibreapp/image-actions@main
|
2021-04-25 11:05:56 +08:00
|
|
|
with:
|
|
|
|
githubToken: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
compressOnly: true
|
|
|
|
|
|
|
|
- name: Commit Files
|
2021-11-04 09:41:41 +08:00
|
|
|
if: |
|
|
|
|
steps.calibre.outputs.markdown != ''
|
2021-04-25 11:05:56 +08:00
|
|
|
run: |
|
|
|
|
git config --local user.email "action@github.com"
|
|
|
|
git config --local user.name "GitHub Action"
|
2021-11-04 09:41:41 +08:00
|
|
|
git commit -m "chore: auto compress images" -a
|
2021-04-25 11:05:56 +08:00
|
|
|
- name: Push Changes
|
|
|
|
uses: ad-m/github-push-action@master
|
|
|
|
with:
|
|
|
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|