[WIP] writing frontend docs #7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Deploy | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
permissions: | |
contents: 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: | |
name: Build and Release Website | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '>= 3.10' | |
- name: "Download main program" | |
id: download_main | |
uses: robinraju/release-downloader@v1 | |
with: | |
repository: "PrepPipe/preppipe-python" | |
tag: "latest-main" | |
fileName: "preppipe-*-py3-none-any.whl" | |
tarBall: false | |
zipBall: false | |
out-file-path: "." | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python3 -m pip install mkdocs | |
python3 -m pip install mkdocs-material | |
python3 -m pip install mkdocs-static-i18n[material] | |
- name: Install main program | |
run: | | |
python3 -m pip install $(ls preppipe-*-py3-none-any.whl) | |
- name: Invoke main program to export documentation | |
run: | | |
PREPPIPE_LANGUAGE=zh_cn PREPPIPE_TOOL=cmddocs python3 -m preppipe.pipeline_cmd --namespace=vn --markdown=docs/zh/script/cmddocs.md | |
PREPPIPE_LANGUAGE=zh_hk PREPPIPE_TOOL=cmddocs python3 -m preppipe.pipeline_cmd --namespace=vn --markdown=docs/zh-Hant/script/cmddocs.md | |
PREPPIPE_LANGUAGE=en PREPPIPE_TOOL=cmddocs python3 -m preppipe.pipeline_cmd --namespace=vn --markdown=docs/en/script/cmddocs.md | |
- name: Build site | |
run: mkdocs build -f mkdocs.yml | |
- name: Create zip archive | |
run: | | |
cd generated | |
zip -r ../docs.zip . | |
- uses: "marvinpinto/action-automatic-releases@latest" | |
with: | |
repo_token: "${{ secrets.GITHUB_TOKEN }}" | |
automatic_release_tag: "latest" | |
prerelease: true | |
title: "自动发布" | |
files: | | |
docs.zip | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v2 | |
with: | |
path: './generated' | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v2 |