mirror of
https://github.com/veeso/termscp.git
synced 2026-06-13 03:59:37 +02:00
ci: add github pages workflow for docs site
This commit is contained in:
66
.github/workflows/pages.yml
vendored
Normal file
66
.github/workflows/pages.yml
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
name: Deploy docs to GitHub Pages
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- "docs/**"
|
||||
- ".github/workflows/pages.yml"
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
concurrency:
|
||||
group: pages
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
pages: write
|
||||
id-token: write
|
||||
environment:
|
||||
name: github-pages
|
||||
url: ${{ steps.deployment.outputs.page_url }}
|
||||
steps:
|
||||
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Install mdBook
|
||||
uses: peaceiris/actions-mdbook@ee69d230fe19748b7abf22df32acaa93833fad08 # v2
|
||||
with:
|
||||
mdbook-version: latest
|
||||
- name: Install mdbook-mermaid
|
||||
run: cargo install mdbook-mermaid
|
||||
- name: Build en-US
|
||||
run: mdbook build docs/en-US
|
||||
- name: Build zh-CN
|
||||
run: mdbook build docs/zh-CN
|
||||
- name: Assemble site
|
||||
run: |
|
||||
rm -rf site_out
|
||||
mkdir -p site_out/en-US site_out/zh-CN
|
||||
cp -r docs/en-US/book/* site_out/en-US/
|
||||
cp -r docs/zh-CN/book/* site_out/zh-CN/
|
||||
cp -r docs/shared site_out/shared
|
||||
cp docs/shared/og_preview.jpg site_out/og_preview.jpg
|
||||
cp docs/shared/favicon.ico site_out/favicon.ico
|
||||
cp docs/CNAME site_out/CNAME
|
||||
cat > site_out/index.html <<'HTML'
|
||||
<!doctype html>
|
||||
<meta charset="utf-8">
|
||||
<title>termscp docs</title>
|
||||
<meta http-equiv="refresh" content="0; url=./en-US/">
|
||||
<link rel="canonical" href="./en-US/">
|
||||
<a href="./en-US/">termscp documentation</a>
|
||||
HTML
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3
|
||||
with:
|
||||
path: site_out
|
||||
- name: Deploy to GitHub Pages
|
||||
id: deployment
|
||||
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4
|
||||
Reference in New Issue
Block a user