From 80d6378e89ac9b03064214af3544f4542a45e793 Mon Sep 17 00:00:00 2001 From: Xiang ZHU Date: Sat, 20 Jan 2024 22:15:11 +0100 Subject: [PATCH] sync current branch to gitee only --- .github/workflows/sync-to-gitee.yml | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/.github/workflows/sync-to-gitee.yml b/.github/workflows/sync-to-gitee.yml index 6863b541..d7acc1c0 100644 --- a/.github/workflows/sync-to-gitee.yml +++ b/.github/workflows/sync-to-gitee.yml @@ -10,15 +10,26 @@ concurrency: group: ${{ github.workflow}} cancel-in-progress: true +env: + GITEE_REPOSITORY: copdips/copdips.github.io jobs: sync_to_gitee: runs-on: ubuntu-latest steps: - # - uses: actions/checkout@v2 - - name: sync-gitee-mirror - uses: abersheeran/sync-gitee-mirror@v1-beta + # - name: sync-gitee-mirror + # uses: abersheeran/sync-gitee-mirror@v1-beta + # # https://github.com/abersheeran/sync-gitee-mirror + # with: + # repository: ${{ env.GITEE_REPOSITORY }} + # username: ${{ env.GITEE_USERNAME }} + # password: ${{ secrets.GITEE_PAT }} + + - uses: actions/checkout@v4 with: - repository: copdips/copdips.github.io - username: ${{ secrets.GITEE_USERNAME }} - password: ${{ secrets.GITEE_PAT }} + fetch-depth: 0 + - run: | + remote_repo="https://${{ vars.GITEE_USERNAME }}:${{ secrets.GITEE_PAT }}@gitee.com/${{ env.GITEE_REPOSITORY }}.git" + git remote add gitee "${remote_repo}" + branch=$(git branch --show-current) + git push gitee $branch -f