当我尝试在 Azure 上部署无框架静态 Web 应用程序时,为什么会从 GitHub Actions 收到生成错误?

Jes*_*sme 7 azure azure-web-app-service github-actions

我有一个简单的静态网站,我尝试使用 GitHub Actions 将其部署为 Azure 静态 Web 应用程序(无框架)。我的目录结构是:

\n
\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 .github/workflows/\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 css/\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 img/\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 js/\n\xe2\x94\x9c index.html\n
Run Code Online (Sandbox Code Playgroud)\n

当我推送到 GitHub 存储库时,Azure 静态 Web 应用 CI/CD 操作将启动生成和部署作业。在 .github/workflows 目录中的 YAML 配置文件中,我为存储库/构建配置设置了以下内容:

\n
app_location: "/"    # The app source code is in the root directory for the repo\napi_location: ""     # There is no API that needs to be configured\noutput_location: "/" # my index.html file is in the root directory for the repo\n
Run Code Online (Sandbox Code Playgroud)\n

但是,我在构建和部署作业中收到以下错误:

\n
\n

无法在应用程序工件文件夹 (/) 中找到默认文件。有效\n默认文件:index.html、Index.html。如果您的应用程序包含\n纯静态内容,请验证工作流文件(位于 .github/workflows 中)中的变量“app_location”\n是否指向应用程序的根目录。

\n
\n

当我指定了 index.html 文件的位置时,为什么会收到此错误?

\n

Jes*_*sme 11

因为部署容器是基于 Ubuntu 的,所以我猜测输出位置可能会与整个系统的根目录混淆。

因此,我将工作流程 YAML 文件中的输出位置设置为:

output_location: "./"
Run Code Online (Sandbox Code Playgroud)

完成此更改后,构建完成并且静态 Web 应用程序部署成功。