From 61ff2f136260ca95f3901948340e4fe21e72192f Mon Sep 17 00:00:00 2001 From: yanglbme Date: Thu, 21 Oct 2021 17:28:54 +0800 Subject: [PATCH] chore: add compress workflow --- .github/workflows/compress.yml | 36 ++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .github/workflows/compress.yml diff --git a/.github/workflows/compress.yml b/.github/workflows/compress.yml new file mode 100644 index 000000000..342e8b996 --- /dev/null +++ b/.github/workflows/compress.yml @@ -0,0 +1,36 @@ +name: Compress + +on: + push: + branches: [main] + paths: + - "**.jpg" + - "**.jpeg" + - "**.png" + - "**.webp" + workflow_dispatch: + +jobs: + compress: + runs-on: ubuntu-latest + if: github.repository == 'doocs/advanced-java' + steps: + - name: Checkout Branch + uses: actions/checkout@v2 + + - name: Compress Images + uses: calibreapp/image-actions@master + with: + githubToken: ${{ secrets.GITHUB_TOKEN }} + compressOnly: true + + - name: Commit Files + run: | + git config --local user.email "action@github.com" + git config --local user.name "GitHub Action" + git commit -m "docs: optimize images" -a + + - name: Push Changes + uses: ad-m/github-push-action@master + with: + github_token: ${{ secrets.GITHUB_TOKEN }}