这是我的文件:
`名称:部署 Shinylive 应用程序
: 推: 分支:[主要] 拉请求: 分支机构:[主要]
工作: 建造: running-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install shinylive
run: pip install shinylive
# Note that you can also specify a version of shinylive, as in:
# pip install shinylive==0.0.8
- name: Make shinylive deployment in docs/
run: shinylive export source docs
- name: Upload website artifact
if: github.ref == 'refs/heads/main'
uses: actions/upload-pages-artifact@v1
with:
path: "docs/"
构建作业完成后,将网站部署到 GitHub Pages
deploy: if: github.ref == 'refs/heads/main' 需要:构建
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1`
我需要 ipywidgets 版本为 7.7.0,但我使用的所有其他软件包都可以是其最新版本才能运行我的应用程序。我如何指定它以便我可以在 GitHub Pages 上运行它?
尝试使用requirements.txt 文件,但它没有执行任何操作。
可以直接在的
deploy.yml
文件中,在
shinylive
安装步骤之后指定
ipywidgets==7.7.0
来安装特定版本的
ipywidgets
。
以下是修改后的
deploy.yml
文件:
name: 部署 Shinylive 应用程序
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install shinylive
run: pip install shinylive
# Note that you can also specify a version of shinylive, as in:
# pip install shinylive==0.0.8
- name: Install ipywidgets 7.7.0
run: pip install ipywidgets==7.7.0
- name: Make shinylive deployment in docs/
run: shinylive export source docs
- name: Upload website artifact
if: github.ref == 'refs/heads/main'
uses: actions/upload-pages-artifact@v1
with:
path: "docs/"
deploy:
if: github.ref == 'refs/heads/main'
needs: build
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
这个修改会在安装
shinylive
后,额外运行
pip install ipywidgets==7.7.0
来安装指定版本的
ipywidgets
。
如果之前创建了
requirements.txt
文件,请确保它包含
ipywidgets==7.7.0
这一行,并将
pip install -r requirements.txt
命令添加到的
deploy.yml
文件中,以确保所有依赖项都已正确安装。