Skip to content

feat: Generate sidebar and nav by version and language #59

feat: Generate sidebar and nav by version and language

feat: Generate sidebar and nav by version and language #59

Workflow file for this run

name: Deploy to GitHub Pages
on:
push:
branches: ['master']
pull_request:
branches: ['master']
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: 'pages'
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
version: ['1.4.3'] # 定义版本数组
steps:
- uses: actions/checkout@v3
- name: Checkout linglong ${{ matrix.version }}
uses: actions/checkout@v4
with:
ref: ${{ matrix.version }} # 使用矩阵中的版本号作为检出的ref
path: ${{ matrix.version }} # 每个版本检出到不同的目录
repository: linuxdeepin/linglong
sparse-checkout: |
docs/pages
sparse-checkout-cone-mode: false
- name: checkout 1.4.3 docs
uses: actions/checkout@v4
with:
ref: 2ba2407e1148b3a084f71269660272a9348360ab # homepage 项目的 v1.4.3
path: '1.4.3'
repository: linuxdeepin/linglong-homepage
sparse-checkout: |
en
guide
sparse-checkout-cone-mode: false
- name: Generate Versions JS File
run: |
tree 1.4.3
verPath=".vitepress/theme/versions.js"
echo "const versions = [''];" > $verPath
for ver in "${{ matrix.version }}"; do
echo "versions.push('$ver');" >> $verPath
done
echo "exports.versions = versions;" >> $verPath
cat $verPath
- uses: actions/setup-node@v3
with:
node-version: 16
cache: 'yarn'
- name: Install Depend
run: yarn install
- name: Build Pages
run: yarn build
- name: Upload Artifact
uses: actions/upload-pages-artifact@v1
with:
path: ./.vitepress/dist
deploy:
runs-on: ubuntu-latest
needs: build
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1