gpt4 book ai didi

azure - 将静态 HTML 网站从 Github 部署到 Azure Static Web App

转载 作者:行者123 更新时间:2023-12-03 05:20:42 25 4
gpt4 key购买 nike

我已在 GitHub 中为我的静态网站创建了一个存储库。有一个名为 website 的文件夹,其中包含该网站的所有静态 html 文件。然后我在 azure 中设置一个静态 Web 应用程序,并使用 GitHub 作为源

enter image description here

创建静态 Web 应用程序后,我的 github 存储库中也立即创建了一个操作,如下所示

name: Azure Static Web Apps CI/CD

on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened, closed]
branches:
- main

jobs:
build_and_deploy_job:
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed')
runs-on: ubuntu-latest
name: Build and Deploy Job
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Build And Deploy
id: builddeploy
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_GRAY_CLIFF_62B10 }}
repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments)
action: "upload"
###### Repository/Build Configurations - These values can be configured to match your app requirements. ######
# For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig
app_location: "/Website" # App source code path
api_location: "" # Api source code path - optional
output_location: "wwwroot" # Built app content directory - optional
###### End of Repository/Build Configurations ######

close_pull_request_job:
if: github.event_name == 'pull_request' && github.event.action == 'closed'
runs-on: ubuntu-latest
name: Close Pull Request Job
steps:
- name: Close Pull Request
id: closepullrequest
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_GRAY_CLIFF_62B10 }}
action: "close"

在我的存储库中,静态网站 (HTML) 文件位于根目录中的 Website 文件夹下。由于我是第一次从 GitHub 部署到 Azure 中的静态 Web 应用程序,因此我不确定输出位置。所以我刚刚输入 wwwroot 猜测这个文件夹是在我的 azure 托管位置创建的。但执行引发了错误

The app build failed to produce artifact folder: 'wwwroot'. Pleaseensure this property is configured correctly in your workflow file.

我不明白我做错了什么。请帮忙。在我的假设中,只有一些静态文件,并且应该将 html 文件复制到静态 Web 应用程序的 Azure 托管区域中。另外,我无法找到可以从 azure 门户获取该信息的位置。

enter image description here

最佳答案

要解决此问题应用程序构建无法生成工件文件夹:“wwwroot”。请确保在您的工作流程文件中正确配置此属性。错误,请尝试以下方法:

根据anthonychu的建议和 Jesuisme :

app_location: "/" 
api_location: ""
app_artifact_location: "wwwroot"
output_location: "./"

could you please help me how can I locate the root folder in azure static web app

您可以使用Kudu console找到根文件夹。或者,如果您使用 VS Code,那么您可以打开 .github 的根目录。存储库。

引用文献:Getting Started with Azure Static Web Apps , Azure App service not able to find root folder pathUse Kudu to Publish Static Website to Azure App Service

关于azure - 将静态 HTML 网站从 Github 部署到 Azure Static Web App,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72601446/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com