# Simple workflow for deploying static content to GitHub Pages name: Deploy static content to Pages on: # Runs on pushes targeting the default branch push: branches: ["main"] # Allows you to run this workflow manually from the Actions tab workflow_dispatch: # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages permissions: contents: read pages: write id-token: write # Allow one concurrent deployment concurrency: group: "pages" cancel-in-progress: true jobs: # Single deploy job since we're just deploying deploy: if: ${{!startsWith(github.event.ref, 'refs/tags/') && contains(github.event.head_commit.message, '[page skip]') == false }} environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }} runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v3 - name: Setup Pages uses: actions/configure-pages@v2 - name: 安装 mdbook uses: extractions/setup-mdbook@v1 - name: Install mdBook shell: pwsh run: | # 设置变量 $urls = @( 'https://github.com/shenjackyuanjie/Minecraft_Science_Tree/releases/download/0.0.3/mdbook-i18n', 'https://github.com/shenjackyuanjie/Minecraft_Science_Tree/releases/download/0.0.3/mdbook-theme', 'https://github.com/shenjackyuanjie/Minecraft_Science_Tree/releases/download/0.0.3/mdbook-cmdrun', 'https://github.com/shenjackyuanjie/Minecraft_Science_Tree/releases/download/0.0.3/mdbook-pagetoc', 'https://github.com/shenjackyuanjie/Minecraft_Science_Tree/releases/download/0.0.3/mdbook-footnote', 'https://github.com/shenjackyuanjie/Minecraft_Science_Tree/releases/download/0.0.3/mdbook-external-links', 'https://github.com/plantuml/plantuml/releases/download/v1.2023.4/plantuml-1.2023.4.jar' ) # 下载文件 foreach ($url in $urls) { Invoke-WebRequest -Uri $url -OutFile "$($url.Split('/')[-1])" } # 将目录路径添加到 $PATH 中 $PWD >> $env:GITHUB_PATH ls $PWD # - name: Setup mdbook-theme latest # run: | # curl -s https://api.github.com/repos/zjp-CN/mdbook-theme/releases/latest \ # | grep browser_download_url \ # | grep mdbook-theme_linux \ # | cut -d '"' -f 4 \ # | wget -qi - # tar -xvzf mdbook-theme_linux.tar.gz # echo $PWD >> $GITHUB_PATH - name: 安装 python 3.11 uses: actions/setup-python@v2 with: python-version: 3.11 - name: 安装 dsm api shell: pwsh run: | pip install synology-api>=0.5.1 - name: build mdbook shell: pwsh run: | # cp docs/theme . cd docs mdbook build cd .. Copy-Item docs/book/README-en.html docs/book/html/README-en.html Get-ChildItem -Recurse -Path .\docs\book\* | ?{$_.PsIsContainer -eq $false} | Get-FileHash -Algorithm MD5 >> .\docs\md5.txt - name: 上传到 github pages uses: actions/upload-pages-artifact@v1 with: # Upload entire repository path: './docs/book/html' - name: 部署到 github pages id: deployment uses: actions/deploy-pages@v1 - name: 上传到 DSM env: DSM_TOKEN: ${{ secrets.DSM_TOKEN }} shell: pwsh run: | python .github/workflows/dsm.py -X utf8