mirror of
https://github.com/MPSU/APS.git
synced 2026-05-25 11:39:26 +00:00
WIP: сборка английской версии mdbook
This commit is contained in:
83
.github/workflows/mdbook.yml
vendored
83
.github/workflows/mdbook.yml
vendored
@@ -1,59 +1,102 @@
|
||||
# Sample workflow for building and deploying a mdBook site to GitHub Pages
|
||||
# Builds the Russian (master) and English (english_version) editions of the
|
||||
# mdBook and deploys them as one GitHub Pages site:
|
||||
#
|
||||
# To get started with mdBook see: https://rust-lang.github.io/mdBook/index.html
|
||||
# /APS/ ← Russian
|
||||
# /APS/en/ ← English
|
||||
#
|
||||
name: Deploy mdBook site to Pages
|
||||
|
||||
on:
|
||||
# Runs on pushes targeting the default branch
|
||||
push:
|
||||
branches: ["master"]
|
||||
|
||||
# Allows you to run this workflow manually from the Actions tab
|
||||
branches: ["master", "english_version"]
|
||||
workflow_dispatch:
|
||||
|
||||
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
|
||||
permissions:
|
||||
contents: read
|
||||
pages: write
|
||||
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: "pages"
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
# Build job
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
MDBOOK_VERSION: 0.4.36
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
# ── 1. Checkout master (Russian) ──────────────────────────────────────
|
||||
- name: Checkout master (Russian)
|
||||
uses: actions/checkout@v4
|
||||
# checks out into $GITHUB_WORKSPACE (i.e. the working directory)
|
||||
|
||||
# ── 2. Install mdBook ─────────────────────────────────────────────────
|
||||
- name: Install mdBook
|
||||
run: |
|
||||
curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf | sh -s -- -y
|
||||
source "$HOME/.cargo/env"
|
||||
cargo install --version "${MDBOOK_VERSION}" mdbook
|
||||
|
||||
# ── 3. Build Russian version ──────────────────────────────────────────
|
||||
- name: Prepare Russian sources
|
||||
run: |
|
||||
chmod +x .github/prepare.sh
|
||||
.github/prepare.sh
|
||||
curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf -y | sh
|
||||
rustup update
|
||||
cargo install --version ${MDBOOK_VERSION} mdbook
|
||||
|
||||
- name: Build Russian (mdbook → ./book/)
|
||||
run: |
|
||||
source "$HOME/.cargo/env"
|
||||
mdbook build
|
||||
|
||||
# ── 4. Checkout English branch ────────────────────────────────────────
|
||||
- name: Checkout english_version branch
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: english_version
|
||||
path: english_src # checked out next to the working directory
|
||||
|
||||
# ── 5. Build English version ──────────────────────────────────────────
|
||||
- name: Prepare English sources
|
||||
run: |
|
||||
cd english_src
|
||||
|
||||
chmod +x .github/prepare.sh
|
||||
.github/prepare.sh
|
||||
|
||||
# Use the dedicated English book.toml (sets site-url = "/APS/en/")
|
||||
cp .github/book_en.toml book.toml
|
||||
|
||||
# Copy language-switcher theme files from the master checkout
|
||||
cp -r ../.github/theme ./theme
|
||||
|
||||
- name: Build English (mdbook → english_src/book/)
|
||||
run: |
|
||||
source "$HOME/.cargo/env"
|
||||
cd english_src
|
||||
mdbook build
|
||||
|
||||
# ── 6. Merge artifacts ────────────────────────────────────────────────
|
||||
- name: Merge English build into Russian book/en/
|
||||
run: |
|
||||
mkdir -p book/en
|
||||
cp -r english_src/book/. book/en/
|
||||
|
||||
# ── 7. Deploy ─────────────────────────────────────────────────────────
|
||||
- name: Setup Pages
|
||||
id: pages
|
||||
uses: actions/configure-pages@v5
|
||||
- name: Build with mdBook
|
||||
run: mdbook build
|
||||
- name: Upload artifact
|
||||
|
||||
- name: Upload Pages artifact
|
||||
uses: actions/upload-pages-artifact@v3
|
||||
with:
|
||||
path: ./book
|
||||
|
||||
# Deployment job
|
||||
deploy:
|
||||
environment:
|
||||
name: github-pages
|
||||
url: ${{ steps.deployment.outputs.page_url }}
|
||||
url: ${{ steps.deployment.outputs.page_url }}
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
steps:
|
||||
|
||||
Reference in New Issue
Block a user