简化镜像仓库同步 workflow (#5004)
This commit is contained in:
18
.github/workflows/cnb.yml
vendored
18
.github/workflows/cnb.yml
vendored
@@ -1,18 +0,0 @@
|
|||||||
name: Sync to CNB
|
|
||||||
|
|
||||||
on:
|
|
||||||
push
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
run:
|
|
||||||
if: ${{ github.repository == 'HMCL-dev/HMCL' }}
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Mirror GitHub to CNB
|
|
||||||
env:
|
|
||||||
SOURCE_REPO: HMCL-dev/HMCL
|
|
||||||
TARGET_REPO: HMCL-dev/HMCL
|
|
||||||
run: |
|
|
||||||
git clone --mirror "https://github.com/$SOURCE_REPO.git" -- repo
|
|
||||||
cd repo
|
|
||||||
git push -f --prune "https://${{ secrets.CNB_SYNC_USERNAME }}:${{ secrets.CNB_SYNC_TOKEN }}@cnb.cool/$TARGET_REPO.git" "refs/heads/*:refs/heads/*" "refs/tags/*:refs/tags/*"
|
|
||||||
21
.github/workflows/gitee.yml
vendored
21
.github/workflows/gitee.yml
vendored
@@ -1,21 +0,0 @@
|
|||||||
name: Sync to Gitee
|
|
||||||
|
|
||||||
on:
|
|
||||||
push
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
run:
|
|
||||||
if: ${{ github.repository_owner == 'HMCL-dev' }}
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Mirror GitHub to Gitee
|
|
||||||
uses: Yikun/hub-mirror-action@v1.4
|
|
||||||
with:
|
|
||||||
src: github/HMCL-dev
|
|
||||||
dst: gitee/huanghongxun
|
|
||||||
static_list: 'HMCL'
|
|
||||||
force_update: true
|
|
||||||
debug: true
|
|
||||||
dst_key: ${{ secrets.GITEE_SYNC_BOT_PRIVATE_KEY }}
|
|
||||||
dst_token: ${{ secrets.GITEE_SYNC_BOT_TOKEN }}
|
|
||||||
cache_path: /github/workspace/hub-mirror-cache
|
|
||||||
29
.github/workflows/mirror.yml
vendored
Normal file
29
.github/workflows/mirror.yml
vendored
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
name: Mirror Repository
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
workflow_call:
|
||||||
|
push:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
mirror:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
target:
|
||||||
|
- name: Gitee
|
||||||
|
repo: gitee.com/huanghongxun/HMCL
|
||||||
|
user: 'GITEE_SYNC_USERNAME'
|
||||||
|
token: 'GITEE_SYNC_TOKEN'
|
||||||
|
- name: CNB
|
||||||
|
repo: cnb.cool/HMCL-dev/HMCL
|
||||||
|
user: 'CNB_SYNC_USERNAME'
|
||||||
|
token: 'CNB_SYNC_TOKEN'
|
||||||
|
name: Mirror to ${{ matrix.target.name }}
|
||||||
|
if: ${{ github.repository == 'HMCL-dev/HMCL' }}
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Mirror GitHub to ${{ matrix.target.name }}
|
||||||
|
run: |
|
||||||
|
git clone --mirror "https://github.com/$GITHUB_REPOSITORY.git" -- repo
|
||||||
|
cd repo
|
||||||
|
git push -f --prune "https://${{ secrets[matrix.target.user] }}:${{ secrets[matrix.target.token] }}@${{ matrix.target.repo }}.git" "refs/heads/*:refs/heads/*" "refs/tags/*:refs/tags/*"
|
||||||
3
.github/workflows/release.yml
vendored
3
.github/workflows/release.yml
vendored
@@ -97,6 +97,9 @@ jobs:
|
|||||||
run: go install "cnb.cool/looc/git-cnb@$GIT_CNB_VERSION"
|
run: go install "cnb.cool/looc/git-cnb@$GIT_CNB_VERSION"
|
||||||
env:
|
env:
|
||||||
GIT_CNB_VERSION: '1.1.2'
|
GIT_CNB_VERSION: '1.1.2'
|
||||||
|
- name: Update mirror repositories
|
||||||
|
if: ${{ env.continue == 'true' }}
|
||||||
|
uses: ./.github/workflows/mirror.yml
|
||||||
- name: Create CNB release
|
- name: Create CNB release
|
||||||
if: ${{ env.continue == 'true' }}
|
if: ${{ env.continue == 'true' }}
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
Reference in New Issue
Block a user