Dalam artikel sebelumnya (dalam bahasa Portugis), saya membahas cara membuat backend GraphQL yang berfungsi penuh hanya menggunakan gambar Docker dan file konfigurasi. Semua ini dapat ditemukan di situs Azure . Untuk saat ini, mari kita bicara tentang cara mengotomatiskan penerapan yang dibuat untuk hosting kami dan pembaruan sisi server kami!
Tujuan dari keseluruhan proyek ini adalah membuat back end untuk arsip konten saya di masa mendatang yang akan dihosting di situs saya . Namun, setiap kali saya memperbarui bagian belakang atau mengubah skema GraphQL, saya harus melakukan penerapan layanan penuh lagi.
, push Azure. . , , GitHub Azure. , GitHub , ?
GitHub, , Travis Circle, . , .
: + backend-:

, , : docker-compose.yml mongoke.yml, GraphQL.
, , «» — !

GitHub , , , . ? , :
- push
- Azure main service, , Azure/login
- 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
