From 90e8e754f4596bb66f74f4dd913c3abe0474ca63 Mon Sep 17 00:00:00 2001 From: cmendible <266546+cmendible@users.noreply.github.com> Date: Mon, 3 Jun 2024 09:30:01 +0200 Subject: [PATCH] updated apiops workflows --- .../workflows/deploy-apis-with-apiops.yaml | 14 ++-- .github/workflows/run-publisher-with-env.yaml | 68 ++++++++++++++++--- 2 files changed, 65 insertions(+), 17 deletions(-) diff --git a/.github/workflows/deploy-apis-with-apiops.yaml b/.github/workflows/deploy-apis-with-apiops.yaml index bc193a2..648c03b 100644 --- a/.github/workflows/deploy-apis-with-apiops.yaml +++ b/.github/workflows/deploy-apis-with-apiops.yaml @@ -9,7 +9,7 @@ on: - ".github/workflows/deploy-apis-with-apiops.yaml" - ".github/workflows/run-publisher-with-env.yaml" - # Allows you to run this workflow manually from the Actions tab + # Allows you to run this workflow manually from the Actions tab workflow_dispatch: inputs: COMMIT_ID_CHOICE: @@ -23,7 +23,6 @@ on: env: APIS_FOLDER: apim_vnet_samples/apiops - jobs: get-commit: runs-on: ubuntu-latest @@ -45,6 +44,7 @@ jobs: echo $APIS_FOLDER outputs: apis_folder: ${{ env.APIS_FOLDER }} + #Publish with Commit ID Push-Changes-To-APIM-Dev-With-Commit-ID: if: (github.event.inputs.COMMIT_ID_CHOICE == 'publish-artifacts-in-last-commit' || github.event.inputs.COMMIT_ID_CHOICE == '') @@ -53,7 +53,7 @@ jobs: with: API_MANAGEMENT_ENVIRONMENT: dev # change this to match the dev environment created in settings COMMIT_ID: ${{ needs.get-commit.outputs.commit_id }} - API_MANAGEMENT_SERVICE_OUTPUT_FOLDER_PATH: ${{ needs.get-apis-folder.outputs.apis_folder }} # change this to the artifacts folder + API_MANAGEMENT_SERVICE_OUTPUT_FOLDER_PATH: ${{ needs.get-apis-folder.outputs.apis_folder }} # change this to the artifacts folder secrets: inherit #Publish without Commit ID. Publishes all artifacts that reside in the artifacts forlder @@ -63,7 +63,7 @@ jobs: uses: ./.github/workflows/run-publisher-with-env.yaml with: API_MANAGEMENT_ENVIRONMENT: dev # change this to match the dev environment created in settings - API_MANAGEMENT_SERVICE_OUTPUT_FOLDER_PATH: ${{ needs.get-apis-folder.outputs.apis_folder }} # change this to the artifacts folder + API_MANAGEMENT_SERVICE_OUTPUT_FOLDER_PATH: ${{ needs.get-apis-folder.outputs.apis_folder }} # change this to the artifacts folder secrets: inherit Push-Changes-To-APIM-Prod-With-Commit-ID: @@ -73,7 +73,7 @@ jobs: with: API_MANAGEMENT_ENVIRONMENT: prod # change this to match the prod environment created in settings CONFIGURATION_YAML_PATH: configuration.prod.yaml # make sure the file is available at the root - API_MANAGEMENT_SERVICE_OUTPUT_FOLDER_PATH: ${{ needs.get-apis-folder.outputs.apis_folder }} # change this to the artifacts folder + API_MANAGEMENT_SERVICE_OUTPUT_FOLDER_PATH: ${{ needs.get-apis-folder.outputs.apis_folder }} # change this to the artifacts folder COMMIT_ID: ${{ needs.get-commit.outputs.commit_id }} secrets: inherit @@ -84,5 +84,5 @@ jobs: with: API_MANAGEMENT_ENVIRONMENT: prod # change this to match the prod environment created in settings CONFIGURATION_YAML_PATH: configuration.prod.yaml # make sure the file is available at the root - API_MANAGEMENT_SERVICE_OUTPUT_FOLDER_PATH: ${{ needs.get-apis-folder.outputs.apis_folder }} # change this to the artifacts folder - secrets: inherit + API_MANAGEMENT_SERVICE_OUTPUT_FOLDER_PATH: ${{ needs.get-apis-folder.outputs.apis_folder }} # change this to the artifacts folder + secrets: inherit \ No newline at end of file diff --git a/.github/workflows/run-publisher-with-env.yaml b/.github/workflows/run-publisher-with-env.yaml index 5562562..04d3d37 100644 --- a/.github/workflows/run-publisher-with-env.yaml +++ b/.github/workflows/run-publisher-with-env.yaml @@ -17,7 +17,7 @@ on: type: string env: - apiops_release_version: v4.9.1 + apiops_release_version: v5.1.4 #By default, this will be Information but if you want something different you will need to add a variable in the Settings -> Environment -> Environment variables section Logging__LogLevel__Default: ${{ vars.LOG_LEVEL }} @@ -30,7 +30,7 @@ jobs: - uses: actions/checkout@v3 with: fetch-depth: 2 - + # Run Spectral - uses: actions/setup-node@v3 with: @@ -69,9 +69,21 @@ jobs: $InformationPreference = "Continue" Write-Information "Downloading publisher..." - $publisherFileName = "${{ runner.os }}" -like "*win*" ? "publisher.win-x64.exe" : "publisher.linux-x64.exe" + $publisherFileName = "publisher.linux-x64" + $publisherFinalFileName = "publisher" + if ("${{ runner.os }}" -like "*win*") { + $publisherFileName = "publisher.win-x64.exe" + $publisherFinalFileName = "publisher.exe" + } + elseif ("${{ runner.os }}" -like "*mac*" -and "${{ runner.arch }}" -like "*arm*") { + $publisherFileName = "publisher.osx-arm64" + } + elseif ("${{ runner.os }}" -like "*mac*" -and "${{ runner.arch }}" -like "*x86_64*") { + $publisherFileName = "publisher.osx-x64" + } + $uri = "https://github.com/Azure/apiops/releases/download/${{ env.apiops_release_version }}/$publisherFileName" - $destinationFilePath = Join-Path "${{ runner.temp }}" "publisher.exe" + $destinationFilePath = Join-Path "${{ runner.temp }}" $publisherFinalFileName Invoke-WebRequest -Uri "$uri" -OutFile "$destinationFilePath" if ("${{ runner.os }}" -like "*linux*") @@ -104,9 +116,21 @@ jobs: $InformationPreference = "Continue" Write-Information "Downloading publisher..." - $publisherFileName = "${{ runner.os }}" -like "*win*" ? "publisher.win-x64.exe" : "publisher.linux-x64.exe" + $publisherFileName = "publisher.linux-x64" + $publisherFinalFileName = "publisher" + if("${{ runner.os }}" -like "*win*"){ + $publisherFileName = "publisher.win-x64.exe" + $publisherFinalFileName = "publisher.exe" + } + elseif("${{ runner.os }}" -like "*mac*" -and "${{ runner.arch }}" -like "*arm*"){ + $publisherFileName = "publisher.osx-arm64" + } + elseif ("${{ runner.os }}" -like "*mac*" -and "${{ runner.arch }}" -like "*x86_64*") { + $publisherFileName = "publisher.osx-x64" + } + $uri = "https://github.com/Azure/apiops/releases/download/${{ env.apiops_release_version }}/$publisherFileName" - $destinationFilePath = Join-Path "${{ runner.temp }}" "publisher.exe" + $destinationFilePath = Join-Path "${{ runner.temp }}" $publisherFinalFileName Invoke-WebRequest -Uri "$uri" -OutFile "$destinationFilePath" if ("${{ runner.os }}" -like "*linux*") @@ -141,9 +165,21 @@ jobs: $InformationPreference = "Continue" Write-Information "Downloading publisher..." - $publisherFileName = "${{ runner.os }}" -like "*win*" ? "publisher.win-x64.exe" : "publisher.linux-x64.exe" + $publisherFileName = "publisher.linux-x64" + $publisherFinalFileName = "publisher" + if("${{ runner.os }}" -like "*win*"){ + $publisherFileName = "publisher.win-x64.exe" + $publisherFinalFileName = "publisher.exe" + } + elseif("${{ runner.os }}" -like "*mac*" -and "${{ runner.arch }}" -like "*arm*"){ + $publisherFileName = "publisher.osx-arm64" + } + elseif ("${{ runner.os }}" -like "*mac*" -and "${{ runner.arch }}" -like "*x86_64*") { + $publisherFileName = "publisher.osx-x64" + } + $uri = "https://github.com/Azure/apiops/releases/download/${{ env.apiops_release_version }}/$publisherFileName" - $destinationFilePath = Join-Path "${{ runner.temp }}" "publisher.exe" + $destinationFilePath = Join-Path "${{ runner.temp }}" $publisherFinalFileName Invoke-WebRequest -Uri "$uri" -OutFile "$destinationFilePath" if ("${{ runner.os }}" -like "*linux*") @@ -177,9 +213,21 @@ jobs: $InformationPreference = "Continue" Write-Information "Downloading publisher..." - $publisherFileName = "${{ runner.os }}" -like "*win*" ? "publisher.win-x64.exe" : "publisher.linux-x64.exe" + $publisherFileName = "publisher.linux-x64" + $publisherFinalFileName = "publisher" + if("${{ runner.os }}" -like "*win*"){ + $publisherFileName = "publisher.win-x64.exe" + $publisherFinalFileName = "publisher.exe" + } + elseif("${{ runner.os }}" -like "*mac*" -and "${{ runner.arch }}" -like "*arm*"){ + $publisherFileName = "publisher.osx-arm64" + } + elseif ("${{ runner.os }}" -like "*mac*" -and "${{ runner.arch }}" -like "*x86_64*") { + $publisherFileName = "publisher.osx-x64" + } + $uri = "https://github.com/Azure/apiops/releases/download/${{ env.apiops_release_version }}/$publisherFileName" - $destinationFilePath = Join-Path "${{ runner.temp }}" "publisher.exe" + $destinationFilePath = Join-Path "${{ runner.temp }}" $publisherFinalFileName Invoke-WebRequest -Uri "$uri" -OutFile "$destinationFilePath" if ("${{ runner.os }}" -like "*linux*")