From f6201fb0497ab42a5bfc68d172ceba3ab9a20e48 Mon Sep 17 00:00:00 2001 From: Mikkel Friborg <111983669+Mikfri@users.noreply.github.com> Date: Thu, 7 Nov 2024 16:56:37 +0100 Subject: [PATCH 1/4] Update DB-Angora.yml --- .github/workflows/DB-Angora.yml | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/workflows/DB-Angora.yml b/.github/workflows/DB-Angora.yml index 09c98da..4a2a08d 100644 --- a/.github/workflows/DB-Angora.yml +++ b/.github/workflows/DB-Angora.yml @@ -53,13 +53,17 @@ jobs: path: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }} - name: Set environment variables + env: + AZURE_SQL_CONNECTION_STRING: ${{ secrets.AZURE_SQL_CONNECTION_STRING }} + JWT_ISSUER: ${{ secrets.JWT_ISSUER }} + JWT_AUDIENCE: ${{ secrets.JWT_AUDIENCE }} + JWT_KEY: ${{ secrets.JWT_KEY }} + ASPNETCORE_ENVIRONMENT: Production shell: pwsh run: | - Add-Content -Path $env:GITHUB_ENV -Value "AZURE_SQL_CONNECTION_STRING=${{ secrets.AZURE_SQL_CONNECTION_STRING }}" - Add-Content -Path $env:GITHUB_ENV -Value "JWT_ISSUER=${{ secrets.JWT_ISSUER }}" - Add-Content -Path $env:GITHUB_ENV -Value "JWT_AUDIENCE=${{ secrets.JWT_AUDIENCE }}" - Add-Content -Path $env:GITHUB_ENV -Value "JWT_KEY=${{ secrets.JWT_KEY }}" - Add-Content -Path $env:GITHUB_ENV -Value "ASPNETCORE_ENVIRONMENT=Production" + Get-ChildItem env: | Where-Object { $_.Name -in @('AZURE_SQL_CONNECTION_STRING','JWT_ISSUER','JWT_AUDIENCE','JWT_KEY','ASPNETCORE_ENVIRONMENT') } | ForEach-Object { + "$($_.Name)=$($_.Value)" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8 + } - name: Debug Environment Variables shell: pwsh @@ -115,4 +119,4 @@ jobs: with: app-name: ${{ env.AZURE_WEBAPP_NAME }} publish-profile: ${{ secrets.DB_Angora_CC97 }} - package: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }} \ No newline at end of file + package: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }} From b95f5dc5c601891cd560a39ec2fdcbf5e54e929b Mon Sep 17 00:00:00 2001 From: Mikkel Friborg <111983669+Mikfri@users.noreply.github.com> Date: Thu, 7 Nov 2024 17:17:59 +0100 Subject: [PATCH 2/4] Update DB-Angora.yml --- .github/workflows/DB-Angora.yml | 56 ++++++++++++++++++--------------- 1 file changed, 30 insertions(+), 26 deletions(-) diff --git a/.github/workflows/DB-Angora.yml b/.github/workflows/DB-Angora.yml index 4a2a08d..8e0a5a9 100644 --- a/.github/workflows/DB-Angora.yml +++ b/.github/workflows/DB-Angora.yml @@ -69,16 +69,18 @@ jobs: shell: pwsh run: | Write-Host "Checking environment variables:" - @( + $envVars = @( "AZURE_SQL_CONNECTION_STRING", "JWT_ISSUER", "JWT_AUDIENCE", "JWT_KEY" - ) | ForEach-Object { - if ([string]::IsNullOrEmpty($env:$_)) { - Write-Host "Warning: $_ is empty or not set" + ) + foreach ($varName in $envVars) { + $value = [Environment]::GetEnvironmentVariable($varName) + if ([string]::IsNullOrEmpty($value)) { + Write-Host "Warning: $varName is empty or not set" } else { - Write-Host "$_ is configured" + Write-Host "$varName is configured" } } @@ -86,27 +88,29 @@ jobs: uses: azure/appservice-settings@v1 with: app-name: ${{ env.AZURE_WEBAPP_NAME }} - app-settings-json: '[ - { - "name": "AZURE_SQL_CONNECTION_STRING", - "value": "${{ secrets.AZURE_SQL_CONNECTION_STRING }}", - "slotSetting": false - }, - { - "name": "JWT_ISSUER", - "value": "${{ secrets.JWT_ISSUER }}", - "slotSetting": false - }, - { - "name": "JWT_AUDIENCE", - "value": "${{ secrets.JWT_AUDIENCE }}", - "slotSetting": false - }, - { - "name": "JWT_KEY", - "value": "${{ secrets.JWT_KEY }}", - "slotSetting": false - }]' + app-settings-json: > + [ + { + "name": "AZURE_SQL_CONNECTION_STRING", + "value": "${{ secrets.AZURE_SQL_CONNECTION_STRING }}", + "slotSetting": false + }, + { + "name": "JWT_ISSUER", + "value": "${{ secrets.JWT_ISSUER }}", + "slotSetting": false + }, + { + "name": "JWT_AUDIENCE", + "value": "${{ secrets.JWT_AUDIENCE }}", + "slotSetting": false + }, + { + "name": "JWT_KEY", + "value": "${{ secrets.JWT_KEY }}", + "slotSetting": false + } + ] - name: Configure Web App Settings uses: azure/appservice-settings@v1 From 1a3fb0f9e50d429633f390e72b48010f8f09fdce Mon Sep 17 00:00:00 2001 From: Mikkel Friborg <111983669+Mikfri@users.noreply.github.com> Date: Thu, 7 Nov 2024 17:52:34 +0100 Subject: [PATCH 3/4] En lille blanding af nyt og gammelt .yaml --- .github/workflows/DB-Angora.yml | 47 +++++---------------------------- 1 file changed, 6 insertions(+), 41 deletions(-) diff --git a/.github/workflows/DB-Angora.yml b/.github/workflows/DB-Angora.yml index 8e0a5a9..946f500 100644 --- a/.github/workflows/DB-Angora.yml +++ b/.github/workflows/DB-Angora.yml @@ -46,6 +46,7 @@ jobs: runs-on: windows-latest needs: build steps: + - name: Download artifact from build job uses: actions/download-artifact@v3 with: @@ -69,55 +70,19 @@ jobs: shell: pwsh run: | Write-Host "Checking environment variables:" - $envVars = @( + @( "AZURE_SQL_CONNECTION_STRING", "JWT_ISSUER", "JWT_AUDIENCE", "JWT_KEY" - ) - foreach ($varName in $envVars) { - $value = [Environment]::GetEnvironmentVariable($varName) - if ([string]::IsNullOrEmpty($value)) { - Write-Host "Warning: $varName is empty or not set" + ) | ForEach-Object { + if ([string]::IsNullOrEmpty($env:$_)) { + Write-Host "Warning: $_ is empty or not set" } else { - Write-Host "$varName is configured" + Write-Host "$_ is configured" } } - - name: Set Web App Configuration - uses: azure/appservice-settings@v1 - with: - app-name: ${{ env.AZURE_WEBAPP_NAME }} - app-settings-json: > - [ - { - "name": "AZURE_SQL_CONNECTION_STRING", - "value": "${{ secrets.AZURE_SQL_CONNECTION_STRING }}", - "slotSetting": false - }, - { - "name": "JWT_ISSUER", - "value": "${{ secrets.JWT_ISSUER }}", - "slotSetting": false - }, - { - "name": "JWT_AUDIENCE", - "value": "${{ secrets.JWT_AUDIENCE }}", - "slotSetting": false - }, - { - "name": "JWT_KEY", - "value": "${{ secrets.JWT_KEY }}", - "slotSetting": false - } - ] - - - name: Configure Web App Settings - uses: azure/appservice-settings@v1 - with: - app-name: ${{ env.AZURE_WEBAPP_NAME }} - general-settings-json: '{"ASPNETCORE_ENVIRONMENT": "Production"}' - - name: Deploy to Azure WebApp uses: azure/webapps-deploy@v2 with: From 1b947a4def983d62a409c0a3c8152f120eab5497 Mon Sep 17 00:00:00 2001 From: Mikkel Friborg <111983669+Mikfri@users.noreply.github.com> Date: Thu, 7 Nov 2024 18:01:05 +0100 Subject: [PATCH 4/4] Tilbage til det som sidst virkede mht Deploy --- .github/workflows/DB-Angora.yml | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/.github/workflows/DB-Angora.yml b/.github/workflows/DB-Angora.yml index 946f500..ef2ab37 100644 --- a/.github/workflows/DB-Angora.yml +++ b/.github/workflows/DB-Angora.yml @@ -60,28 +60,8 @@ jobs: JWT_AUDIENCE: ${{ secrets.JWT_AUDIENCE }} JWT_KEY: ${{ secrets.JWT_KEY }} ASPNETCORE_ENVIRONMENT: Production - shell: pwsh run: | - Get-ChildItem env: | Where-Object { $_.Name -in @('AZURE_SQL_CONNECTION_STRING','JWT_ISSUER','JWT_AUDIENCE','JWT_KEY','ASPNETCORE_ENVIRONMENT') } | ForEach-Object { - "$($_.Name)=$($_.Value)" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8 - } - - - name: Debug Environment Variables - shell: pwsh - run: | - Write-Host "Checking environment variables:" - @( - "AZURE_SQL_CONNECTION_STRING", - "JWT_ISSUER", - "JWT_AUDIENCE", - "JWT_KEY" - ) | ForEach-Object { - if ([string]::IsNullOrEmpty($env:$_)) { - Write-Host "Warning: $_ is empty or not set" - } else { - Write-Host "$_ is configured" - } - } + echo "Environment variables set." - name: Deploy to Azure WebApp uses: azure/webapps-deploy@v2