从零开始到集装箱自动化仅需7分钟

之前的文章(葡萄牙语)中,我介绍了如何仅使用Docker映像和配置文件来创建功能齐全的GraphQL后端。所有这些都可以在Azure网站上找到现在,让我们谈谈如何自动化为托管和服务器端更新创建的部署!



整个项目的目标是为我将来托管在我的站点上的内容存档创建一个后端但是,无论何时更新后端或更改GraphQL模式,都必须再次进行完整的服务部署。



, push Azure. . , , GitHub Azure. , GitHub , ?



GitHub Actions





GitHub, , Travis Circle, . , .



: + backend-:





, , : docker-compose.yml mongoke.yml, GraphQL.



, , «» — !





GitHub , , , . ? , :



  1. push
  2. Azure main service, , Azure/login
  3. Azure/cli, .


:



  • GitHub , , URL- YAML- Mongoke
  • URI MongoDB,




-, : , , URL- MongoDB . «» «». , « » . URI MongoDB, MONGODB_URI.





Azure



GitHub Azure, Service Principal. .



Azure CLI. az login, :



az ad sp create-for-rbac --name <SP-name> --role contributor --scopes /subscriptions/<subscriptionID>/resourceGroups/<resourcegroupname> --sdk-auth


ID , az account list : isDefault true. , , : , .



: , , Resource Group. « -», - .



JSON :



{
  "clientId": "xxxxxxx",
  "clientSecret": "xxxxxxxx",
  "subscriptionId": "xxxxxxxx",
  ...
}


GitHub AZURE_CREDENTIALS:





:







, «» «» « »:





, :





, GitHub Actions — , YAML- /.Github/workflows. , . publish-prod.yml:



:





— GitHub, :





, . , push , , , . , , intellisense:





, . . the official documentation

, , , . env:





, . , . , . , :





Ubuntu, : in the documentation. . — , . , !



, Azure ! Azure/ :





. , :





. , AZURE_CREDENTIALS. , , : $ {{secrets.AZURE_CREDENTIALS}}.



:





, « », — Azure. run, , . :





, MONGOKE_CONFIG_URL. , SHA- , . , . « URL-».



Workflow Command, GitHub Actions, ::. set-env, . : ::set-env name=<name>::<value>, :





, ${{env.MONGOKE_CONFIG_URL}} ?v= native environment variable, GITHUB_SHA. :





, , . MONGOKE_CONFIG_URL, MONGOKE_URL:





:





« » :







«»:





, . , , :





Azure , :





, , URL- :







7 Azure , , , , !



GitHub Actions !



!






. - , dev.to




All Articles