From e74161c0aefbb204720cdfea42538f66dd61ab5b Mon Sep 17 00:00:00 2001 From: jsxiaosi <1531733886@qq.com> Date: Wed, 11 Dec 2024 22:07:19 +0800 Subject: [PATCH] =?UTF-8?q?ci(.github):=20=F0=9F=9B=A0=20-=20=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E5=90=88=E5=B9=B6GitHub=20pages?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/auto-merge.yml | 49 ++++++++++++++++++++++++++++++++ .github/workflows/git-pages.yml | 2 ++ 2 files changed, 51 insertions(+) create mode 100644 .github/workflows/auto-merge.yml diff --git a/.github/workflows/auto-merge.yml b/.github/workflows/auto-merge.yml new file mode 100644 index 00000000..93428af9 --- /dev/null +++ b/.github/workflows/auto-merge.yml @@ -0,0 +1,49 @@ +name: Auto merge main into git-pages + +on: + push: + branches: + - main + pull_request: + types: [closed] + +permissions: + contents: write + +jobs: + sync: + if: github.event.pull_request.merged == true || github.event_name == 'push' + runs-on: ubuntu-latest + + steps: + - name: Checkout main branch + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Configure Git + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + + - name: Add git-pages remote + run: | + git remote add git-pages https://${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git + + - name: Fetch git-pages branch + run: git fetch origin git-pages:git-pages + + - name: Checkout git-page branch + run: git checkout git-pages + + - name: Merge main into git-pages + run: | + git merge main --no-ff -m "feat: ✨ Auto-merge main into git-pages" + + - name: Push changes to git-pages + run: git push origin git-pages + + - name: Repository Dispatch + uses: peter-evans/repository-dispatch@v3 + with: + event-type: git-pages-deploy diff --git a/.github/workflows/git-pages.yml b/.github/workflows/git-pages.yml index 410aaacc..318ec3ea 100644 --- a/.github/workflows/git-pages.yml +++ b/.github/workflows/git-pages.yml @@ -4,6 +4,8 @@ on: push: branches: - git-pages + repository_dispatch: + types: [git-pages-deploy] jobs: build: