Update sync-to-gitea.yml
This commit is contained in:
parent
585f7fdaeb
commit
3062ca85fc
17
.github/workflows/sync-to-gitea.yml
vendored
17
.github/workflows/sync-to-gitea.yml
vendored
@ -1,13 +1,14 @@
|
|||||||
name: Sync to Gitea
|
name: Sync all branches to Gitea
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main # 你可以指定特定的分支,比如master或者其他分支
|
- '*' # 监听所有分支的变化
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
sync:
|
sync:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout GitHub repository
|
- name: Checkout GitHub repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
@ -18,11 +19,17 @@ jobs:
|
|||||||
git_user_name: 'Your Name'
|
git_user_name: 'Your Name'
|
||||||
git_user_email: 'your-email@example.com'
|
git_user_email: 'your-email@example.com'
|
||||||
|
|
||||||
- name: Push to Gitea
|
- name: Push all branches to Gitea
|
||||||
env:
|
env:
|
||||||
GITEA_URL: 'http://124.220.61.41:5000' # 你的Gitea地址
|
GITEA_URL: 'http://124.220.61.41:5000' # 你的Gitea地址
|
||||||
GITEA_REPO: 'zhudongjer/openpilot' # Gitea上的仓库名
|
GITEA_REPO: 'zhudongjer/openpilot' # Gitea上的仓库名
|
||||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }} # GitHub Secrets中配置的Gitea访问令牌
|
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }} # GitHub Secrets中配置的Gitea访问令牌
|
||||||
run: |
|
run: |
|
||||||
git remote add gitea https://your_gitea_user:${{ secrets.GITEA_TOKEN }}@${GITEA_URL}/api/v1/repos/${GITEA_REPO}/push
|
# 获取所有的远程分支
|
||||||
git push gitea main # 如果你推送的是其他分支,请修改为相应分支名
|
git fetch --all
|
||||||
|
|
||||||
|
# 遍历每一个分支并推送到Gitea
|
||||||
|
for branch in $(git branch -r | grep -v '\->'); do
|
||||||
|
git checkout --track $branch
|
||||||
|
git push https://your_gitea_user:${{ secrets.GITEA_TOKEN }}@${GITEA_URL}/api/v1/repos/${GITEA_REPO}/push HEAD:$branch
|
||||||
|
done
|
||||||
|
Loading…
x
Reference in New Issue
Block a user