-
-
Notifications
You must be signed in to change notification settings - Fork 201
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test(GitHub Action): 测试GitHub Action
- Loading branch information
Showing
1 changed file
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |