优化镜像仓库同步功能 (#5006)

This commit is contained in:
Glavo
2025-12-19 16:47:12 +08:00
committed by GitHub
parent f77f005f88
commit c4d4c6fcf3
2 changed files with 13 additions and 8 deletions

View File

@@ -2,9 +2,12 @@ name: Mirror Repository
on: on:
workflow_dispatch: workflow_dispatch:
workflow_call:
push: push:
concurrency:
group: mirror-repository
cancel-in-progress: true
jobs: jobs:
mirror: mirror:
strategy: strategy:

View File

@@ -97,27 +97,29 @@ 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: |
echo "Uploading tags to CNB"
git fetch --tags
git push "https://cnb:${{ secrets.CNB_SYNC_TOKEN }}@cnb.cool/$CNB_REPO.git" "$HMCL_TAG_NAME"
echo "Creating CNB release"
~/go/bin/git-cnb release create \ ~/go/bin/git-cnb release create \
--repo "$CNB_REPO" \ --repo "$CNB_REPO" \
--tag "v$HMCL_VERSION" \ --tag "$HMCL_TAG_NAME" \
--name "HMCL $HMCL_VERSION" \ --name "HMCL $HMCL_VERSION" \
--body "$(cat CNB_RELEASE_NOTE)" \ --body "$(cat CNB_RELEASE_NOTE)" \
--prerelease true --prerelease true
echo "Uploading HMCL-$HMCL_VERSION.jar" echo "Uploading HMCL-$HMCL_VERSION.jar"
~/go/bin/git-cnb release asset-upload --repo="$CNB_REPO" --tag-name "v$HMCL_VERSION" --file-name "HMCL-$HMCL_VERSION.jar" ~/go/bin/git-cnb release asset-upload --repo="$CNB_REPO" --tag-name "$HMCL_TAG_NAME" --file-name "HMCL-$HMCL_VERSION.jar"
echo "Uploading HMCL-$HMCL_VERSION.exe" echo "Uploading HMCL-$HMCL_VERSION.exe"
~/go/bin/git-cnb release asset-upload --repo="$CNB_REPO" --tag-name "v$HMCL_VERSION" --file-name "HMCL-$HMCL_VERSION.exe" ~/go/bin/git-cnb release asset-upload --repo="$CNB_REPO" --tag-name "$HMCL_TAG_NAME" --file-name "HMCL-$HMCL_VERSION.exe"
echo "Uploading HMCL-$HMCL_VERSION.sh" echo "Uploading HMCL-$HMCL_VERSION.sh"
~/go/bin/git-cnb release asset-upload --repo="$CNB_REPO" --tag-name "v$HMCL_VERSION" --file-name "HMCL-$HMCL_VERSION.sh" ~/go/bin/git-cnb release asset-upload --repo="$CNB_REPO" --tag-name "$HMCL_TAG_NAME" --file-name "HMCL-$HMCL_VERSION.sh"
env: env:
CNB_TOKEN: ${{ secrets.CNB_SYNC_TOKEN }} CNB_TOKEN: ${{ secrets.CNB_SYNC_TOKEN }}
CNB_REPO: HMCL-dev/HMCL CNB_REPO: HMCL-dev/HMCL