try to use dsm

Update page.yml

Update page.yml
This commit is contained in:
shenjack 2023-03-11 15:04:15 +08:00
parent 6ea058701e
commit 57d113fc94
3 changed files with 61 additions and 4 deletions

31
.github/workflows/dsm.py vendored Normal file
View File

@ -0,0 +1,31 @@
# -------------------------------
# Difficult Rocket
# Copyright © 2020-2023 by shenjackyuanjie 3695888@qq.com
# All rights reserved
# -------------------------------
import os
from synology_api import filestation
# 输出 文档构建目录 的内容
docs_build = 'docs/book/html'
for root, dirs, files in os.walk(docs_build):
print(root, dirs, files)
# 获取 token
token = os.environ['DSM_TOKEN']
username = os.environ['DSM_USERNAME']
fl = filestation.FileStation(ip_address='hws.shenjack.top',
port=5000,
username=username,
password=token,
secure=False,
cert_verify=False,
dsm_version=7,
debug=True)
print(fl.get_info())
print(fl.get_file_list('/web'))

View File

@ -27,7 +27,9 @@ jobs:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
@ -38,16 +40,37 @@ jobs:
- name: install mdbook
uses: extractions/setup-mdbook@v1
- name: setup、build mdbook
- name: setup python 3.11
uses: actions/setup-python@v2
with:
python-version: 3.11
- name: install dsm api
shell: pwsh
run: |
pip install synology-api>=0.5.1
- name: build mdbook
shell: pwsh
run: |
mdbook build ./docs/
cd docs
Copy-Item book/README-en.html book/html/README-en.html
- name: Upload artifact
- name: 上传到 github pages
uses: actions/upload-pages-artifact@v1
with:
# Upload entire repository
path: './docs/book/html'
- name: Deploy to GitHub Pages
- name: 部署到 github pages
id: deployment
uses: actions/deploy-pages@v1
- name: 上传到 DSM
env:
DSM_TOKEN: ${{ secrets.DSM_TOKEN }}
DSM_USERNAME: ${{ secrets.DSM_USERNAME }}
shell: pwsh
run: |
python .github/workflows/dsm.py

View File

@ -1,2 +1,5 @@
# for checker
ruff >= 0.0.253
# ruff >= 0.0.253
# for dsm upload
synology-api >= 0.5.1