【发布时间】:2021-09-28 20:50:34
【问题描述】:
此工件中有超过 10,000 个文件,请考虑在上传前创建存档以提高上传性能。
【问题讨论】:
标签: node.js azure github-actions
此工件中有超过 10,000 个文件,请考虑在上传前创建存档以提高上传性能。
【问题讨论】:
标签: node.js azure github-actions
我在将节点应用部署到 Azure 应用服务时遇到了这个问题。
我通过添加一个 zip 和一个解压缩步骤来修复它。
压缩步骤是
- name: Zip artifact for deployment
run: zip release.zip ./* -r
解压步骤是
- name: unzip artifact for deployment
run: unzip release.zip
像这样在构建步骤之后和上传工件步骤之前添加 zip 步骤
- name: npm install, build, and test
run: |
npm install
npm run build --if-present
npm run test --if-present
- name: Zip artifact for deployment
run: zip release.zip ./* -r
- name: Upload artifact for deployment job
uses: actions/upload-artifact@v2
with:
name: node-app
path: release.zip
然后像这样在下载工件步骤之后和部署步骤之前添加解压缩步骤。
steps:
- name: Download artifact from build job
uses: actions/download-artifact@v2
with:
name: node-app
- name: unzip artifact for deployment
run: unzip release.zip
- name: 'Deploy to Azure Web App'
id: deploy-to-webapp
uses: azure/webapps-deploy@v2
with:
【讨论】:
zip -r release.zip * .env .next)
rm release.zip删除压缩文件
在将基于 React 的应用部署到 Azure 应用服务时,我也遇到了这个问题。
补充@steve写的答案,如果App服务实例是基于windows的,可以使用Powershell的Compress-Archive。
在构建步骤中 - 压缩
Compress-Archive . release.zip
在部署步骤中 - 解压
Expand-Archive release.zip
或
unzip release.zip
如果部署脚本使用 bash
【讨论】:
您可以使用以下命令压缩所有文件,然后将 zip 文件夹作为您的工件上传。
zip artifact.zip <generated_files>/*
【讨论】: