我在 GitHub 中為我的靜態網站創建了一個存盤庫。有一個名為網站的檔案夾,它包含該網站的所有靜態 html 檔案。然后我在 azure 中設定了一個靜態 Web 應用程式,以 GitHub 作為源

在創建靜態 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) 檔案位于根目錄下的網站檔案夾下。由于我是第一次從 GitHub 部署到 Azure 中的靜態 Web 應用程式,因此我不確定輸出位置。所以我剛剛輸入 wwwroot 猜測這個檔案夾是在我的 azure 托管位置創建的。但是執行引發了錯誤
應用程式構建未能生成工件檔案夾:“wwwroot”。請確保在您的作業流檔案中正確配置了此屬性。
我不明白我做錯了什么。請幫忙。在我的假設中,只有一些靜態檔案,并且應該將 html 檔案復制到我的靜態 Web 應用程式的天藍色托管區域中。此外,我無法找到可以從 azure 門戶獲取的資訊。

uj5u.com熱心網友回復:
要解決此The app build failed to produce artifact folder: 'wwwroot'. Please ensure this property is configured correctly in your workflow file.錯誤,請嘗試以下方法:
正如anthonychu和Jesuisme所建議的:
app_location: "/"
api_location: ""
app_artifact_location: "wwwroot"
output_location: "./"
您能幫我嗎?如何在 azure static web 應用程式中找到根檔案夾
您可以使用Kudu 控制臺找到根檔案夾。或者,如果您使用的是 VS Code,則可以打開.github存盤庫的根目錄。
參考:Azure 靜態 Web 應用入門、Azure 應用服務找不到根檔案夾路徑和使用 Kudu 將靜態網站發布到 Azure 應用服務
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/490905.html
