diff --git a/.github/COPY_STATIC.yml b/.github/COPY_STATIC.yml deleted file mode 100644 index f8d1ce59..00000000 --- a/.github/COPY_STATIC.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: COPY STATIC - -on: - push: - branches: - - 'master' - - 'develop' - # Sequence of patterns matched against refs/tags - tags: - - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 - workflow_dispatch: - -jobs: - to_gitlab: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - uses: pixta-dev/repository-mirroring-action@v1 - with: - target_repo_url: - git@gitlab.com:whyour/qinglong-static.git - ssh_private_key: - ${{ secrets.GITLAB_SSH_PK }} - - to_gitee: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - uses: pixta-dev/repository-mirroring-action@v1 - with: - target_repo_url: - git@gitee.com:whyour/qinglong-static.git - ssh_private_key: - ${{ secrets.GITLAB_SSH_PK }} \ No newline at end of file diff --git a/.github/workflows/build_docker_image.yml b/.github/workflows/build_docker_image.yml index 0c377760..d81808ce 100644 --- a/.github/workflows/build_docker_image.yml +++ b/.github/workflows/build_docker_image.yml @@ -60,18 +60,29 @@ jobs: env: GITHUB_REPO: github.com/${{ github.repository_owner }}/qinglong-static GITHUB_BRANCH: ${{ github.ref_name }} + REPO_GITEE: git@gitee.com:whyour/qinglong-static.git + REPO_GITLAB: git@gitlab.com:whyour/qinglong-static.git + PRIVATE_KEY: ${{ secrets.GITLAB_SSH_PK }} run: | mkdir -p tmp cd ./tmp - mkdir -p .github/workflows cp -rf ../static/* ./ - cp ../.github/COPY_STATIC.yml ./.github/workflows/ git init -b ${GITHUB_BRANCH} && git add . git config --local user.name 'github-actions[bot]' git config --local user.email 'github-actions[bot]@users.noreply.github.com' git commit --allow-empty -m "copy static at $(date +'%Y-%m-%d %H:%M:%S')" git push --force --quiet "https://${{ secrets.API_TOKEN }}@${GITHUB_REPO}.git" ${GITHUB_BRANCH}:${GITHUB_BRANCH} + mkdir -p ~/.ssh + echo "${PRIVATE_KEY}" > ~/.ssh/id_rsa + chmod 600 ~/.ssh/id_rsa + + export GIT_SSH_COMMAND="ssh -v -i ~/.ssh/id_rsa -o StrictHostKeyChecking=no -l ${PRIVATE_KEY}" + git remote add gitee "${REPO_GITEE}" + git remote add gitlab "${REPO_GITLAB}" + git push --tags --force --prune gitee "refs/remotes/origin/*:refs/heads/*" + git push --tags --force --prune gitlab "refs/remotes/origin/*:refs/heads/*" + build: needs: build-static