aboutsummaryrefslogtreecommitdiff
path: root/.forgejo/workflows/mkdocs-deploy.yml
diff options
context:
space:
mode:
authorFangcatChina <f20091219@outlook.com>2026-08-14 11:43:01 +0000
committerFangcatChina <f20091219@outlook.com>2026-08-14 14:39:38 +0000
commit7a75cdf0d395f179a27f69e9829e3c9e39302223 (patch)
treecb349d0d9dbbfdfa04f2f0c4800b01f381027d77 /.forgejo/workflows/mkdocs-deploy.yml
parentfix: tuna mirror (diff)
feat: new workflow
Diffstat (limited to '.forgejo/workflows/mkdocs-deploy.yml')
-rw-r--r--.forgejo/workflows/mkdocs-deploy.yml57
1 files changed, 57 insertions, 0 deletions
diff --git a/.forgejo/workflows/mkdocs-deploy.yml b/.forgejo/workflows/mkdocs-deploy.yml
new file mode 100644
index 0000000..efb6592
--- /dev/null
+++ b/.forgejo/workflows/mkdocs-deploy.yml
@@ -0,0 +1,57 @@
+name: Deploy MkDocs to Another Repository
+
+on:
+ push:
+ branches:
+ - main
+ paths:
+ - 'docs/**'
+ - 'mkdocs.yml'
+ - 'overrides/**'
+ - '.forgejo/workflows/mkdocs-deploy.yml'
+ workflow_dispatch:
+
+permissions:
+ contents: read
+
+concurrency:
+ group: "pages"
+ cancel-in-progress: false
+
+jobs:
+ build-and-deploy:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout source code
+ uses: actions/checkout@v4
+ with:
+ fetch-depth: 0
+
+ - name: Set up Python
+ uses: actions/setup-python@v5
+ with:
+ python-version: '3.13'
+ cache: 'pip'
+
+ - name: Install MkDocs dependencies
+ run: |
+ python -m pip install --upgrade pip
+ pip install -r requirements.txt
+
+ - name: Build MkDocs site
+ run: mkdocs build --strict
+
+ - name: Deploy to target repository
+ env:
+ TARGET_REPO: https://codeberg.org/LinuxCabin/handbook-site
+ TARGET_BRANCH: pages
+ DEPLOY_TOKEN: ${{ secrets.DEPLOY_TOKEN }}
+ run: |
+ cd site
+ echo "hb.linuxcabin.top" > CNAME
+ git init
+ git config user.name "forgejo-actions[bot]"
+ git config user.email "forgejo-actions[bot]@users.noreply.github.com"
+ git add .
+ git commit -m "Deploy site $(date -u '+%Y-%m-%d %H:%M:%S UTC')"
+ git push --force https://x-access-token:${DEPLOY_TOKEN}@${TARGET_REPO#https://} HEAD:${TARGET_BRANCH} \ No newline at end of file