【发布时间】:2022-10-05 09:01:47
【问题描述】:
我正在使用 GitHub 操作来构建和部署 Vue Azure 静态 Web 应用程序。使用默认模板时,我位于 Vue 应用程序根目录的 staticwebapp.config.json 文件被正确应用,我看到 Copying 'staticwebapp.config.json' to build output 已记录。
当使用自定义的 GitHub 工作流程(如下所示)分离将 skip_app_build 设置为 true 的构建和部署步骤时,上传/下载的工件不包含 staticwebapp.config.json 文件。
如何修改 GitHub 操作以确保 staticwebapp.config.json 文件 gets copied 到输出目录以便它被部署?
jobs:
build:
if: github.event_name == 'push'
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v3
- name: npm install and run build
run: npm install && npm run build
- name: Upload artifact
uses: actions/upload-artifact@v3.1.0
with:
name: app
path: dist/
deploy:
runs-on: ubuntu-latest
needs: build
steps:
- name: Download artifact
uses: actions/download-artifact@v3.0.0
with:
name: app
- name: Deploy to Azure
id: deploy
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_BLUE_STONE_0BAB0F910 }}
repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for GitHub integrations (i.e. PR comments)
action: "upload"
###### Repository/Build Configurations ######
app_location: "" # App source code path relative to repository root
api_location: "" # Api source code path relative to repository root - optional
skip_app_build: true
###### End of Repository/Build Configurations ######
【问题讨论】:
-
如果您在本地删除 dist 文件夹,然后再次在本地构建,您是否真的看到了 staticwebapp.config.json?也许它只需要在构建后手动复制到 dist 文件夹
-
@misha130 - 我能够将
staticwebapp.config.json文件放在public目录中,然后可以通过部署步骤获取它。谢谢! -
不妨为您的问题添加答案,以帮助其他正在寻找解决方案的人
标签: azure github github-actions azure-static-web-app azure-static-website-hosting