[英]azure static web app, how to have two different web apps (one prod and one non prod) building from the same git repo?
We have two static apps, one for production and one for non production (test).我们有两个 static 应用程序,一个用于生产,一个用于非生产(测试)。 They just show a site down page for when our main site on AEM is down (using traffic manager to switch).当我们在 AEM 上的主站点关闭时(使用流量管理器切换),他们只是显示一个站点关闭页面。
The source is held in an Azure devops git repo.源代码保存在 Azure devops git repo 中。
This is how it is built in non prod:这就是它在非产品中的构建方式:
trigger:
- main
pool:
vmImage: ubuntu-latest
steps:
- checkout: self
submodules: true
- task: AzureStaticWebApp@0
inputs:
app_location: '/'
api_location: ''
output_location: ''
azure_static_web_apps_api_token: $(deployment_token)
Now we want to make it build a prod version of the static web app, if we push to another branch (eg "prod").现在我们想让它构建 static web 应用程序的生产版本,如果我们推送到另一个分支(例如“prod”)。 Any idea how we might do this?知道我们该怎么做吗? Not sure how we would differentiate between the prod static web app deployment token and the non prod one either?不确定我们如何区分产品 static web 应用程序部署令牌和非产品?
Please take a look on this example .请看看这个例子。 Here you have three main steps:这里有三个主要步骤:
It is implementation of approach build once deploy many, which is good because it means that on each env you use the same package, so you trully test the package which is going to be deployed to production.它是一次构建多次部署的方法的实现,这很好,因为这意味着在每个环境中你使用相同的 package,所以你真正测试将要部署到生产环境中的 package。
In terms of token, you can put this is two seprate variables group.就令牌而言,您可以把它放在两个单独的变量组中。 One name dev, and the other prod.一个名称为 dev,另一个名称为 prod。 Both should have the same variable deployment_token
and then两者都应该有相同的变量deployment_token
然后
- stage: Prod
dependsOn: Dev
variables:
- group: Prod
- stage: Dev
dependsOn: Build
variables:
- group: Dev
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.