From 8f42246d1af7f4546a0a7e84b43dd6be8364496e Mon Sep 17 00:00:00 2001 From: Baba Kamyljanov Date: Wed, 11 Sep 2024 13:43:18 +0800 Subject: [PATCH 1/5] test --- .github/workflows/test.yml | 121 +++++++++++++++++++++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..3b0fab4 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,121 @@ +name: Test + +on: + push: + branches: [fix-functions] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Setup .NET 8.0.x + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 8.0.x + + - name: Restore dependencies + working-directory: SSW.Rules.AzFuncs/ + run: dotnet restore + + - name: Build + working-directory: SSW.Rules.AzFuncs/ + run: dotnet build --no-restore + + - name: Deploy + working-directory: SSW.Rules.AzFuncs/ + run: | + dotnet publish \ + --configuration Release \ + --output ../deploy + + - name: Upload a Build Artifact + uses: actions/upload-artifact@v4 + with: + name: functionsapp + path: deploy + + validate-resources: + runs-on: ubuntu-latest + environment: staging + + steps: + - uses: actions/checkout@v4 + - name: Setup .NET 8.0.x + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 8.0.x + + - name: Generate ARM Template + working-directory: Azure/ + run: dotnet run + env: + AUTH0_AUDIENCE: ${{ secrets.AUTH0_AUDIENCE }} + AUTH0_ISSUER: ${{ secrets.AUTH0_ISSUER }} + AZURE_RG_PREFIX: ${{ secrets.AZURE_RG_PREFIX }} + GITHUB_TOKEN: ${{ secrets.AZ_FUNC_GITHUB_PAT}} + CMS_OAUTH_CLIENT_ID: ${{ secrets.STAGING_CMS_OAUTH_CLIENT_ID }} + CMS_OAUTH_CLIENT_SECRET: ${{ secrets.STAGING_CMS_OAUTH_CLIENT_SECRET }} + + - name: Login with Azure CLI + uses: azure/login@v2 + with: + creds: ${{ secrets.AZURE_CREDENTIALS }} + + - name: Run ARM deploy + uses: azure/arm-deploy@v2 + with: + subscriptionId: ${{ secrets.AZURE_SUBSCRIPTION }} + resourceGroupName: ${{ secrets.AZURE_RG }} + template: Azure/arm-template.json + deploymentMode: Validate + + - name: Upload a Build Artifact + uses: actions/upload-artifact@v4 + with: + name: arm-template + path: Azure/arm-template.json + + deploy: + needs: [build, validate-resources] + if: ${{ github.ref == 'refs/heads/fix-functions' }} + environment: staging + runs-on: ubuntu-latest + + steps: + - uses: actions/download-artifact@v4 + with: + name: arm-template + + - name: Login with Azure CLI + uses: azure/login@v2 + with: + creds: ${{ secrets.AZURE_CREDENTIALS }} + + - name: Run ARM deploy + uses: azure/arm-deploy@v2 + with: + subscriptionId: ${{ secrets.AZURE_SUBSCRIPTION }} + resourceGroupName: ${{ secrets.AZURE_RG }} + template: arm-template.json + + - name: Setup .NET 8.0.x + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 8.0.x + + - uses: actions/download-artifact@v4 + with: + name: functionsapp + path: deploy + + - name: List contents of deploy folder + run: ls -la deploy + + - name: "Run Azure Functions Action" + uses: Azure/functions-action@v1 + id: fa + with: + app-name: ${{ secrets.AZURE_RG_PREFIX }}-functions + package: deploy From 1e4437f54dca2a7a213248d6e64870086774a098 Mon Sep 17 00:00:00 2001 From: Baba Kamyljanov Date: Wed, 11 Sep 2024 14:03:30 +0800 Subject: [PATCH 2/5] test 2 --- .github/workflows/test.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3b0fab4..8290a35 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -26,9 +26,10 @@ jobs: - name: Deploy working-directory: SSW.Rules.AzFuncs/ run: | - dotnet publish \ - --configuration Release \ - --output ../deploy + dotnet publish --configuration Release --output ../deploy + + - name: List Files After Publish + run: ls -R ../deploy - name: Upload a Build Artifact uses: actions/upload-artifact@v4 From 3f111d89cd0b88a9f7e2a5fe6b698dce3dd603b9 Mon Sep 17 00:00:00 2001 From: Baba Kamyljanov Date: Wed, 11 Sep 2024 14:10:46 +0800 Subject: [PATCH 3/5] test 3 --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8290a35..63175ea 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -29,6 +29,7 @@ jobs: dotnet publish --configuration Release --output ../deploy - name: List Files After Publish + working-directory: SSW.Rules.AzFuncs/ run: ls -R ../deploy - name: Upload a Build Artifact From 0657fb8d5e670b9db15791d37c7208e60d632816 Mon Sep 17 00:00:00 2001 From: Baba Kamyljanov Date: Wed, 11 Sep 2024 14:19:01 +0800 Subject: [PATCH 4/5] test --- .github/workflows/test.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 63175ea..81d5059 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -27,16 +27,13 @@ jobs: working-directory: SSW.Rules.AzFuncs/ run: | dotnet publish --configuration Release --output ../deploy - - - name: List Files After Publish - working-directory: SSW.Rules.AzFuncs/ - run: ls -R ../deploy - name: Upload a Build Artifact uses: actions/upload-artifact@v4 with: name: functionsapp path: deploy + include-hidden-files: true validate-resources: runs-on: ubuntu-latest From d5ad910b3f14a8635df19e89125d6bc7a9627334 Mon Sep 17 00:00:00 2001 From: Baba Kamyljanov Date: Wed, 11 Sep 2024 14:30:35 +0800 Subject: [PATCH 5/5] added new option to upload hidden folders because after upgrading v4 version, the functions wasn't deployed correctly --- .github/workflows/build.yml | 1 + .github/workflows/release.yml | 1 + .github/workflows/test.yml | 120 ---------------------------------- 3 files changed, 2 insertions(+), 120 deletions(-) delete mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4f8a4d6..9f624c6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -37,6 +37,7 @@ jobs: with: name: functionsapp path: deploy + include-hidden-files: true validate-resources: runs-on: ubuntu-latest diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index cfa2221..7134f8e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -36,6 +36,7 @@ jobs: with: name: functionsapp path: deploy + include-hidden-files: true validate-resources: runs-on: ubuntu-latest diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index 81d5059..0000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,120 +0,0 @@ -name: Test - -on: - push: - branches: [fix-functions] - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - name: Setup .NET 8.0.x - uses: actions/setup-dotnet@v4 - with: - dotnet-version: 8.0.x - - - name: Restore dependencies - working-directory: SSW.Rules.AzFuncs/ - run: dotnet restore - - - name: Build - working-directory: SSW.Rules.AzFuncs/ - run: dotnet build --no-restore - - - name: Deploy - working-directory: SSW.Rules.AzFuncs/ - run: | - dotnet publish --configuration Release --output ../deploy - - - name: Upload a Build Artifact - uses: actions/upload-artifact@v4 - with: - name: functionsapp - path: deploy - include-hidden-files: true - - validate-resources: - runs-on: ubuntu-latest - environment: staging - - steps: - - uses: actions/checkout@v4 - - name: Setup .NET 8.0.x - uses: actions/setup-dotnet@v4 - with: - dotnet-version: 8.0.x - - - name: Generate ARM Template - working-directory: Azure/ - run: dotnet run - env: - AUTH0_AUDIENCE: ${{ secrets.AUTH0_AUDIENCE }} - AUTH0_ISSUER: ${{ secrets.AUTH0_ISSUER }} - AZURE_RG_PREFIX: ${{ secrets.AZURE_RG_PREFIX }} - GITHUB_TOKEN: ${{ secrets.AZ_FUNC_GITHUB_PAT}} - CMS_OAUTH_CLIENT_ID: ${{ secrets.STAGING_CMS_OAUTH_CLIENT_ID }} - CMS_OAUTH_CLIENT_SECRET: ${{ secrets.STAGING_CMS_OAUTH_CLIENT_SECRET }} - - - name: Login with Azure CLI - uses: azure/login@v2 - with: - creds: ${{ secrets.AZURE_CREDENTIALS }} - - - name: Run ARM deploy - uses: azure/arm-deploy@v2 - with: - subscriptionId: ${{ secrets.AZURE_SUBSCRIPTION }} - resourceGroupName: ${{ secrets.AZURE_RG }} - template: Azure/arm-template.json - deploymentMode: Validate - - - name: Upload a Build Artifact - uses: actions/upload-artifact@v4 - with: - name: arm-template - path: Azure/arm-template.json - - deploy: - needs: [build, validate-resources] - if: ${{ github.ref == 'refs/heads/fix-functions' }} - environment: staging - runs-on: ubuntu-latest - - steps: - - uses: actions/download-artifact@v4 - with: - name: arm-template - - - name: Login with Azure CLI - uses: azure/login@v2 - with: - creds: ${{ secrets.AZURE_CREDENTIALS }} - - - name: Run ARM deploy - uses: azure/arm-deploy@v2 - with: - subscriptionId: ${{ secrets.AZURE_SUBSCRIPTION }} - resourceGroupName: ${{ secrets.AZURE_RG }} - template: arm-template.json - - - name: Setup .NET 8.0.x - uses: actions/setup-dotnet@v4 - with: - dotnet-version: 8.0.x - - - uses: actions/download-artifact@v4 - with: - name: functionsapp - path: deploy - - - name: List contents of deploy folder - run: ls -la deploy - - - name: "Run Azure Functions Action" - uses: Azure/functions-action@v1 - id: fa - with: - app-name: ${{ secrets.AZURE_RG_PREFIX }}-functions - package: deploy