我在GitHub中为我的静态网站创建了一个存储库。有一个名为“网站”的文件夹,它包含网站的所有静态html文件。然后,我用GitHub作为源代码,在蔚蓝中安装了一个静态Web
在创建静态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,所以我不确定输出位置。所以我刚输入www.root猜测这个文件夹是在我的azure托管位置创建的。但是执行引发了一个错误
应用程序构建未能生成工件文件夹:“www.root”。请确保此属性在您的工作流文件中配置正确。
我不明白我做错了什么。请帮帮忙。在我的假设中,只有一些静态文件,并且假设将html文件复制到我的静态web应用程序的蔚蓝托管区域。此外,我也无法找到我可以从蔚蓝门户获取的信息。
发布于 2022-06-13 11:51:40
若要解决此The app build failed to produce artifact folder: 'wwwroot'. Please ensure this property is configured correctly in your workflow file.
错误,请尝试以下方式:
app_location: "/"
api_location: ""
app_artifact_location: "wwwroot"
output_location: "./"
你能帮我找一下在azure静态web应用程序中的根文件夹吗?
您可以使用苦斗控制台定位根文件夹。或者,如果使用VS代码,则可以打开.github
存储库的根。
参考文献:开始使用Azure静态Web应用程序,Azure App服务无法找到根文件夹路径和使用Kudu将静态网站发布到Azure App Service
发布于 2022-07-28 14:53:24
我的所有文件都在src文件夹中(我的项目只有HTML和js文件)
这是我的github操作文件:
name: Deploy web app to Azure Static Web Apps
env:
APP_LOCATION: "src" # location of your client code
#API_LOCATION: "api" # location of your api source code - optional
APP_ARTIFACT_LOCATION: "wwwroot" #"build" # location of client code build output
on:
push:
branches:
- main
paths:
- 'src/**'
pull_request:
types: [opened, synchronize, reopened, closed]
branches:
- main
permissions:
issues: write
contents: read
jobs:
build_and_deploy:
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed')
runs-on: ubuntu-latest
name: Build and Deploy
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Build And Deploy
uses: Azure/static-web-apps-deploy@1a947af9992250f3bc2e68ad0754c0b0c11566c9
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_BRAVE_DESERT_08C538C10 }}
repo_token: ${{ secrets.GITHUB_TOKEN }}
action: "upload"
app_location: ${{ env.APP_LOCATION }}
#api_location: ${{ env.API_LOCATION }}
app_artifact_location: ${{ env.APP_ARTIFACT_LOCATION }}
close:
if: github.event_name == 'pull_request' && github.event.action == 'closed'
runs-on: ubuntu-latest
name: Close
steps:
- name: Close
uses: Azure/static-web-apps-deploy@1a947af9992250f3bc2e68ad0754c0b0c11566c9
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_BRAVE_DESERT_08C538C10 }}
action: "close"
你还需要把你的Tocken添加到Github的秘密中。
在这里,您将在Azure中的静态Web应用程序资源中获得Tocken
在get之后,您需要插入这是您的秘密,如下:
,请注意秘密名称。需要是你的Github操作文件中的一些.。
https://stackoverflow.com/questions/72601446
复制相似问题