Deploy Order #8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy Order | |
on: | |
workflow_dispatch: | |
inputs: { } | |
push: | |
branches: | |
- Azure | |
paths: | |
- 'apps/acme-order/**' | |
env: | |
SPRING_APPS_SERVICE: ${{ secrets.SPRING_APPS_SERVICE }} | |
RESOURCE_GROUP: ${{ secrets.RESOURCE_GROUP }} | |
KEY_VAULT: ${{ secrets.KEY_VAULT }} | |
CUSTOM_BUILDER: no-bindings-builder | |
ORDER_SERVICE_APP: order-service | |
permissions: | |
id-token: write | |
contents: read | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: apps/acme-order | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up .NET Core SDK | |
uses: actions/setup-dotnet@v2 | |
- name: Install dependencies | |
run: dotnet restore | |
- name: Build | |
run: dotnet build --configuration Release --no-restore | |
- name: Test | |
run: dotnet test --no-restore --verbosity normal | |
- name: Set up Azure | |
uses: azure/login@v1 | |
with: | |
client-id: ${{ secrets.AZURE_CLIENT_ID }} | |
tenant-id: ${{ secrets.AZURE_TENANT_ID }} | |
subscription-id: ${{ secrets.SUBSCRIPTION }} | |
- name: Set up Azure Spring Extension | |
run: az extension add --name spring | |
- name: Deploy Order | |
run: | | |
keyvault_uri=$(az keyvault show \ | |
--resource-group ${RESOURCE_GROUP} \ | |
--name ${KEY_VAULT} \ | |
--query properties.vaultUri -o tsv) | |
gateway_url=$(az spring gateway show \ | |
--resource-group ${RESOURCE_GROUP} \ | |
--service ${SPRING_APPS_SERVICE} \ | |
--query properties.url -o tsv) | |
az spring app deploy \ | |
--name ${ORDER_SERVICE_APP} \ | |
--resource-group "$RESOURCE_GROUP" \ | |
--service "$SPRING_APPS_SERVICE" \ | |
--env "ConnectionStrings__KeyVaultUri=${keyvault_uri}" "AcmeServiceSettings__AuthUrl=https://${gateway_url}" "DatabaseProvider=Postgres" \ | |
--builder ${CUSTOM_BUILDER} \ | |
--source-path ./ |