Test with logging and add null protection #33
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 | |
on: | |
workflow_dispatch: | |
inputs: { } | |
push: | |
branches: | |
- main | |
env: | |
SPRING_APPS_SERVICE: ${{ secrets.SPRING_APPS_SERVICE }} | |
RESOURCE_GROUP: ${{ secrets.RESOURCE_GROUP }} | |
KEY_VAULT: ${{ secrets.KEY_VAULT }} | |
PROJECT_API_APP: project-api | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'adopt' | |
- name: Validate Gradle wrapper | |
uses: gradle/wrapper-validation-action@v1 | |
- name: Build with Gradle | |
uses: gradle/gradle-build-action@v2 | |
with: | |
arguments: build | |
build-root-directory: . | |
- name: Set up Azure | |
uses: azure/login@cb79c773a3cfa27f31f25eb3f677781210c9ce3d | |
with: | |
creds: ${{ secrets.AZURE_CREDENTIALS_SPRING_IO }} | |
- name: Set up Azure Spring Extension | |
run: az extension add --name spring | |
- name: Create app | |
run: | | |
az spring app create \ | |
--name ${PROJECT_API_APP} \ | |
--resource-group "$RESOURCE_GROUP" \ | |
--instance-count 2 \ | |
--assign-endpoint true \ | |
--service "$SPRING_APPS_SERVICE" | |
continue-on-error: true | |
- name: Deploy | |
run: | | |
keyvault_uri=$(az keyvault show \ | |
--resource-group ${RESOURCE_GROUP} \ | |
--name ${KEY_VAULT} | jq -r '.properties.vaultUri') | |
az spring app deploy \ | |
--name ${PROJECT_API_APP} \ | |
--resource-group "$RESOURCE_GROUP" \ | |
--build-env BP_JVM_VERSION=17 \ | |
--service "$SPRING_APPS_SERVICE" \ | |
--env "SPRING_CLOUD_AZURE_KEYVAULT_SECRET_PROPERTY_SOURCES_0_ENDPOINT=${keyvault_uri}" "SPRING_CLOUD_AZURE_KEYVAULT_SECRET_PROPERTY_SOURCES_0_NAME=${KEY_VAULT}" "SPRING_PROFILES_ACTIVE=key-vault" \ | |
--source-path ./ |