mirror of
https://github.com/doocs/md.git
synced 2024-11-28 13:36:32 +08:00
39 lines
915 B
YAML
39 lines
915 B
YAML
name: Compress
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
paths:
|
|
- "**.jpg"
|
|
- "**.jpeg"
|
|
- "**.png"
|
|
- "**.webp"
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
compress:
|
|
runs-on: ubuntu-latest
|
|
if: github.repository == 'doocs/md'
|
|
steps:
|
|
- name: Checkout Branch
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Compress Images
|
|
id: calibre
|
|
uses: calibreapp/image-actions@main
|
|
with:
|
|
githubToken: ${{ secrets.GITHUB_TOKEN }}
|
|
compressOnly: true
|
|
|
|
- name: Commit Files
|
|
if: |
|
|
steps.calibre.outputs.markdown != ''
|
|
run: |
|
|
git config --local user.email "action@github.com"
|
|
git config --local user.name "GitHub Action"
|
|
git commit -m "chore: auto compress images" -a
|
|
- name: Push Changes
|
|
uses: ad-m/github-push-action@master
|
|
with:
|
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|