From 99e5920d454231a97e27ed4099b76b251d0fd6dd Mon Sep 17 00:00:00 2001 From: yanglbme Date: Sun, 25 Apr 2021 11:05:56 +0800 Subject: [PATCH] chore: update github actions --- .github/workflows/branch-merge.yml | 17 --------------- .github/workflows/build.yml | 10 ++++++++- .github/workflows/compress.yml | 34 ++++++++++++++++++++++++++++++ .github/workflows/sync.yml | 18 ---------------- 4 files changed, 43 insertions(+), 36 deletions(-) delete mode 100644 .github/workflows/branch-merge.yml create mode 100644 .github/workflows/compress.yml delete mode 100644 .github/workflows/sync.yml diff --git a/.github/workflows/branch-merge.yml b/.github/workflows/branch-merge.yml deleted file mode 100644 index e4c405f..0000000 --- a/.github/workflows/branch-merge.yml +++ /dev/null @@ -1,17 +0,0 @@ -name: Merge Branch - -on: - push: - branches: [imgbot] - -jobs: - merge-branch: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: everlytic/branch-merge@1.1.0 - with: - github_token: ${{ github.token }} - source_ref: ${{ github.ref }} - target_branch: main - commit_message_template: "[Automated] Merged {source_ref} into {target_branch}" diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 007bf47..3753e6d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -36,8 +36,16 @@ jobs: run: npm run build - name: Deploy - uses: JamesIves/github-pages-deploy-action@4.0.0 + uses: JamesIves/github-pages-deploy-action@4.1.1 with: ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }} BRANCH: gh-pages FOLDER: dist + + - name: Sync to Gitee + uses: wearerequired/git-mirror-action@master + env: + SSH_PRIVATE_KEY: ${{ secrets.GITEE_RSA_PRIVATE_KEY }} + with: + source-repo: git@github.com:doocs/md.git + destination-repo: git@gitee.com:Doocs/md.git diff --git a/.github/workflows/compress.yml b/.github/workflows/compress.yml new file mode 100644 index 0000000..f83e77d --- /dev/null +++ b/.github/workflows/compress.yml @@ -0,0 +1,34 @@ +name: Compress + +on: + push: + branches: [main] + paths: + - "**.jpg" + - "**.jpeg" + - "**.png" + - "**.webp" + +jobs: + compress: + runs-on: ubuntu-latest + if: github.repository == 'doocs/md' + 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 "[Automated] Optimize images" -a + - name: Push Changes + uses: ad-m/github-push-action@master + with: + github_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/sync.yml b/.github/workflows/sync.yml deleted file mode 100644 index ca7d4ee..0000000 --- a/.github/workflows/sync.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: Sync - -on: - push: - branches: [main] - -jobs: - build: - runs-on: ubuntu-latest - if: github.repository == 'doocs/md' - steps: - - name: Sync to Gitee - uses: wearerequired/git-mirror-action@master - env: - SSH_PRIVATE_KEY: ${{ secrets.GITEE_RSA_PRIVATE_KEY }} - with: - source-repo: git@github.com:doocs/md.git - destination-repo: git@gitee.com:Doocs/md.git