Skip to content

Workflow file for this run

name: Sync to Gitee
on:
# Runs on pushes targeting the default branch
push:
branches:
- main
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "sync"
cancel-in-progress: false
# Default to bash
defaults:
run:
shell: bash
jobs:
sync:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Create Gitee Repo
shell: bash
run: |
mkdir gitee_repo
mkdir gitee_repo/help
mkdir gitee_repo/plugins
mv -v "content/zh-cn/help"/* "gitee_repo/help/"
mv -v "content/zh-cn/plugins"/* "gitee_repo/plugins/"
mv -v "static"/* "gitee_repo/"
rm "gitee_repo/help/_index.md"
rm "gitee_repo/plugins/_index.md"
- name: Find and Replace
uses: jacobtomlinson/gha-find-replace@v3
with:
find: "/images"
replace: "../../images"
include: "gitee_repo/**.md"
regex: false
- name: Sync to Gitee
shell: bash
run: |
cd gitee_repo
git config --global user.name "${GITHUB_ACTOR}"
git config --global user.email "${GITHUB_ACTOR_ID}+${GITHUB_ACTOR}@users.noreply.github.com"
remote_repo="https://${{ github.actor }}:${{ secrets.GITEE_PAT }}@gitee.com/ZL-Audio/ZLWiki.git"
git init --initial-branch=main
git add -A
git commit -m "sync to gitee"
git remote add gitee "${remote_repo}"
git show-ref
git branch --verbose
git push --all --force gitee
git push --tags --force gitee