Skip to content

Commit

Permalink
updated apiops workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
cmendible committed Jun 3, 2024
1 parent 2bffc48 commit 90e8e75
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 17 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/deploy-apis-with-apiops.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -23,7 +23,6 @@ on:

env:
APIS_FOLDER: apim_vnet_samples/apiops

jobs:
get-commit:
runs-on: ubuntu-latest
Expand All @@ -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 == '')
Expand All @@ -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
Expand All @@ -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:
Expand All @@ -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

Expand All @@ -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
68 changes: 58 additions & 10 deletions .github/workflows/run-publisher-with-env.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}

Expand All @@ -30,7 +30,7 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 2

# Run Spectral
- uses: actions/setup-node@v3
with:
Expand Down Expand Up @@ -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*")
Expand Down Expand Up @@ -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*")
Expand Down Expand Up @@ -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*")
Expand Down Expand Up @@ -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*")
Expand Down

0 comments on commit 90e8e75

Please sign in to comment.