将静态HTML网站从GitHub部署到Azure静态Web应用程序
我在Github为静态网站创建了一个存储库。那里有一个名为网站的文件夹,它包含该网站的所有静态HTML文件。然后,我用github在Azure中设置了一个静态Web应用程序,作为源
立即创建静态Web应用程序后,
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"
在我的GitHub存储库中也可以在我的静态网站(html) 中创建一个操作。文件位于root的网站文件夹下。由于我首先从GitHub部署到Azure中的静态Web应用程序,因此我不确定输出位置。因此,我刚刚进入wwwroot,猜测这个文件夹在我的Azure托管位置中创建。但是执行发出了错误
应用程序构建未能生成伪影文件夹:'wwwroot'。请 确保在工作流文件中正确配置此属性。
我不明白我做错了什么。请帮忙。在我的假设中,只有一些静态文件,并且可以将HTML文件复制到我的静态Web应用程序的Azure托管区域中。另外,我无法找到可以从Azure Portal获取的信息。
I have created a repository in GitHub for my static website. There a Folder called website and it contains all the static html files for the website. Then I setup a Static Web App in azure with GitHub as source
Immediately upon creating the static web app, one action also got created in my github repository like this
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"
Here in my repository the static website (HTML) files are under Website folder in Root. Since I am first to the deploy from GitHub into Static Web App in Azure, I was not sure about the output location. So I just entered wwwroot guessing this folder get created in my azure hosting location. But the execution fired an error
The app build failed to produce artifact folder: 'wwwroot'. Please
ensure this property is configured correctly in your workflow file.
I didnt understand what I did wrong. Please help. In my assumption there was just some static files and it was suppposed to copy the html files into my azure hosting region of my static web app. Also I am not able to locate where that information i can fetch from azure portal.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
为了解决此
,应用程序构建未能产生伪影文件夹:'wwwroot'。请确保在工作流文件中正确配置此属性。
错误,尝试以下方式:如 anthonychu 和 jesuisme
您可以使用 kudu控制台找到根文件夹。另外,如果使用VS代码,则可以打开
.github
存储库。参考:从Azure static Web应用程序开始, azure应用服务无法找到根文件夹路径和使用Kudu将静态网站发布到Azure App Service
To resolve this
The app build failed to produce artifact folder: 'wwwroot'. Please ensure this property is configured correctly in your workflow file.
error, try following way:As suggested by anthonychu and Jesuisme:
You can use Kudu console to locate the root folder. Alternatively, if you are using VS Code, then you can open the root of your
.github
repository.References: Getting Started with Azure Static Web Apps, Azure App service not able to find root folder path and Use Kudu to Publish Static Website to Azure App Service
我在SRC文件夹中有所有文件(我的项目只有HTML ANS JS文件)
,这是我的GitHub操作文件:
您仍然需要在GitHub Secret中添加托克。
中,您将在静态Web应用程序资源中获得托管
在这里,您将在Azure Cloud
获得后,您需要插入这是您的秘密,例如:
,秘密名称的关注。需要是您的github操作文件中的某些。
I have all my files in src folder (my project only have HTML ans js files)
and here is my github actions file:
You still need to add your Tocken in Github Secrets.
Here you will get the Tocken in your Static Web App resource in Azure Cloud
After get, you need to insert this is your secrets, like this:
Please, attenttion on Secret Name. Needs to be the some on your Github Actions file.