From 1f295e21052b6519fba9c199b9e9822b99feecf9 Mon Sep 17 00:00:00 2001 From: Mintimate Date: Tue, 14 Nov 2023 21:52:12 +0800 Subject: [PATCH] =?UTF-8?q?Test(GitHub=20Action):=20=E6=B5=8B=E8=AF=95GitH?= =?UTF-8?q?ub=20Action?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/mirrorToGitLab.yaml | 33 +++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .github/workflows/mirrorToGitLab.yaml diff --git a/.github/workflows/mirrorToGitLab.yaml b/.github/workflows/mirrorToGitLab.yaml new file mode 100644 index 0000000..e6837b7 --- /dev/null +++ b/.github/workflows/mirrorToGitLab.yaml @@ -0,0 +1,33 @@ +name: Sync Repo To GitLab + +on: + push: + branches: + - main + +env: + SSH_KEY: ${{ secrets.GITLAB_DEPLOY_KEY }} # 服务器私钥 + DEPLOY_HOST: ${{ secrets.GITLAB_DEPLOY_HOST }} # 服务器部署地址 + DEPLOY_USERNAME: ${{ secrets.GITLAB_DEPLOY_USERNAME }} # 部署用户 + DEPLOY_EMAIL: ${{ secrets.GITLAB_DEPLOY_EMAIL }} # 部署邮箱 + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Prepare to Gitlab repo + run: | + git config --global user.name ${{ env.DEPLOY_USERNAME }} + git config --global user.email ${{ env.DEPLOY_EMAIL }} + git remote add gitlab_mirror ${{ env.DEPLOY_HOST }} + - name: Commit files + run: | + git add . + git commit -m "Sync files from Github repo" + - name: Push files + env: + ssh-key: ${{ env.SSH_KEY }} + run: | + git push gitlab_mirror main