md/.github/workflows/compress.yml

36 lines
908 B
YAML
Raw Normal View History

2022-08-09 21:26:50 +08:00
name: Compress images
2021-04-25 11:05:56 +08:00
on:
2022-08-09 21:26:50 +08:00
schedule:
- cron: "0 0 * * 3"
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:
2022-08-09 21:26:50 +08:00
githubToken: ${{ secrets.ACTION_TOKEN }}
2021-04-25 11:05:56 +08:00
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: |
2022-08-09 21:26:50 +08:00
git config --local user.email "szuyanglb@outlook.com"
git config --local user.name "yanglbme"
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
2022-08-09 21:26:50 +08:00
if: |
steps.calibre.outputs.markdown != ''
2021-04-25 11:05:56 +08:00
uses: ad-m/github-push-action@master
with:
2022-08-09 21:26:50 +08:00
github_token: ${{ secrets.ACTION_TOKEN }}