Difficult-Rocket/.github/workflows/page.yml
shenjack fd5963bc0a [build skip] use dsm with secret
[build skip] add delete task and try upload

[build skip] key error fix

[build skip] key error?

not use secret

Update dsm.py

Update dsm.py

Update dsm.py

Update dsm.py

Update dsm.py

Update dsm.py

Update dsm.py

[build skip] try use better

一些奇怪东西

update with md5_check

Update page.yml

Update page.yml

try build

fix: last md5 detect use local one

add more mdbook extention

reformat and add more

add cmd run

i18n not 18n

try use local build mdbook

Update page.yml

try with openai

Update page.yml

Update page.yml

Update page.yml

Update page.yml

Update page.yml

Update page.yml

Update dsm.py

Update dsm.py

Update dsm.py

Update dsm.py

Update dsm.py

Update dsm.py

Update dsm.py

Update dsm.py

try new one

use custom TEMP

use new path

逝逝

page toc later

add back debug print

try to add back pagetoc

try to use pagetoc-0.1.7 [build skip]

just upload the theme folder~ [build skip]

get plant UML [build skip]

add log out for dsm.py [build skip]

clean up useless "f"
2023-03-19 11:46:27 +08:00

115 lines
4.2 KiB
YAML

# 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: 安装 mdbook 扩展
# shell: pwsh
# run: |
# # mdbook mdbook-i18n mdbook-footnote mdbook-pagetoc mdbook-cmdrun
# Write-Host "GITHUB_PATH is: $env:GITHUB_PATH"
# $mdbookPath = "$env:GITHUB_PATH\mdbook.exe"
# Write-Host "mdbook path is: $mdbookPath"
# Invoke-WebRequest -Uri "http://shenjack.top:81/mdbook/mdbook-i18n.exe" -OutFile $env:GITHUB_PATH\mdbook-i18n.exe
# Invoke-WebRequest -Uri "http://shenjack.top:81/mdbook/mdbook-cmdrun.exe" -OutFile $env:GITHUB_PATH\mdbook-cmdrun.exe
# Invoke-WebRequest -Uri "http://shenjack.top:81/mdbook/mdbook-pagetoc.exe" -OutFile $env:GITHUB_PATH\mdbook-pagetoc.exe
# Invoke-WebRequest -Uri "http://shenjack.top:81/mdbook/mdbook-footnote.exe" -OutFile $env:GITHUB_PATH\mdbook-footnote.exe
- name: Install mdBook
shell: pwsh
run: |
# 设置变量
$urls = @(
'https://github.com/shenjackyuanjie/Minecraft_Science_Tree/releases/download/0.0.2/mdbook-i18n',
'https://github.com/shenjackyuanjie/Minecraft_Science_Tree/releases/download/0.0.2/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.2/mdbook-footnote',
'https://github.com/plantuml/plantuml/releases/download/v1.2023.4/plantuml-1.2023.4.jar'
)
$temp = 'mdbook'
# 创建目录
if (!(Test-Path -Path $temp -PathType Container)) {
New-Item -Path $temp -ItemType Directory -Force
}
# 下载文件
foreach ($url in $urls) {
Invoke-WebRequest -Uri $url -OutFile "$temp/$($url.Split('/')[-1])"
}
# Invoke-WebRequest -Uri $url1 -OutFile 'mdbook/mdbook-i18n'
# Invoke-WebRequest -Uri $url2 -OutFile 'mdbook/mdbook-cmdrun'
# Invoke-WebRequest -Uri $url3 -OutFile 'mdbook/mdbook-pagetoc'
# Invoke-WebRequest -Uri $url4 -OutFile 'mdbook/mdbook-footnote'
# 将目录路径添加到 $PATH 中
echo "$temp" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- 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: |
mdbook build ./docs/
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