【问题标题】:Azure static web appsAzure 静态 Web 应用
【发布时间】:2021-05-23 20:30:08
【问题描述】:

Azure 静态 Web 应用程序(预览版)目前仅适用于 github 帐户,作为公司政策,我们必须将 Azure 用于 repos 和其他所有内容(管道、发布等)。我们将使用静态 Web仅用于查看简单 Angular 网站的应用程序,但所有源代码必须保留在 azure devops 存储库中。

是否可以创建一个私人 github 帐户并仅将已编译的 Angular 文件上传到它以使用静态 Web 应用程序?例如,我们已经有一个管道来编译 Angular 网站并将其部署到 Azure Web 应用程序服务,是否可以修改此管道以将相同的文件发布到 github 帐户?如果是的话怎么办?

【问题讨论】:

标签: github pipeline azure-static-web-app


【解决方案1】:

您可以在 Azure Devops 中执行此操作。尝试将此 YML 放入 Azure DevOps Pipeline

    trigger:
- main

pool:
  vmImage: 'ubuntu-latest'

name: 'yourApplicationName'

steps:
- task: NodeTool@0
  inputs:
    versionSpec: '12.x'
  displayName: 'Install Node.js'
    
- script: |
    npm install -g @angular/cli
    npm install
  displayName: 'npm install'
  workingDirectory: '$(Build.SourcesDirectory)/yourApplicationName'  
  
- task: AzureStaticWebApp@0
  inputs:
      app_location: "/yourApplicationName" 
      api_location: "api"
      app_build_command: $(build_command)
      output_location: "dist/yourApplicationName"
  env:
      azure_static_web_apps_api_token: $(deployment_token)

您可以将 build_command 和 deployment_token 放在变量中

【讨论】:

    【解决方案2】:

    Azure SWA 目前仅适用于 Github 中的代码。

    但是,您可以通过 Azure 应用服务获得非常接近的结果。微软甚至有a couple blog posts关于如何一起配置 Azure App Service、Azure Repos 和 Azure Pipelines。

    【讨论】:

    • 是的,我正在尝试看看我是否可以做一个“黑客”并将编译后的文件直接上传到 github
    猜你喜欢
    • 2021-08-24
    • 2020-12-16
    • 2021-04-21
    • 2021-07-22
    • 1970-01-01
    • 1970-01-01
    • 2022-01-20
    • 2021-05-25
    • 1970-01-01
    相关资源
    最近更新 更多