-
Notifications
You must be signed in to change notification settings - Fork 0
68 lines (62 loc) · 2 KB
/
sync.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
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