From 317d6f84c073d0b27692b814d45492b892bed8f9 Mon Sep 17 00:00:00 2001 From: DataScNina <146072819+DataScNina@users.noreply.github.com> Date: Mon, 2 Jun 2025 11:45:57 +0200 Subject: [PATCH 1/2] Add or update the App Service deployment workflow configuration from Azure Portal. --- .../master_securityshepherd-demo.yml | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 .github/workflows/master_securityshepherd-demo.yml diff --git a/.github/workflows/master_securityshepherd-demo.yml b/.github/workflows/master_securityshepherd-demo.yml new file mode 100644 index 000000000..7822e0dae --- /dev/null +++ b/.github/workflows/master_securityshepherd-demo.yml @@ -0,0 +1,51 @@ +# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy +# More GitHub Actions for Azure: https://github.com/Azure/actions + +name: Build and deploy container app to Azure Web App - securityshepherd-demo + +on: + push: + branches: + - master + workflow_dispatch: + +jobs: + build: + runs-on: 'ubuntu-latest' + + steps: + - uses: actions/checkout@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Log in to registry + uses: docker/login-action@v2 + with: + registry: https://mcr.microsoft.com/ + username: ${{ secrets.AzureAppService_ContainerUsername_bf9962b498a24875ba9d9338e99e414d }} + password: ${{ secrets.AzureAppService_ContainerPassword_2e20e57f29054195ab0cfe5eecde3784 }} + + - name: Build and push container image to registry + uses: docker/build-push-action@v3 + with: + push: true + tags: mcr.microsoft.com/${{ secrets.AzureAppService_ContainerUsername_bf9962b498a24875ba9d9338e99e414d }}/appsvc/staticsite:${{ github.sha }} + file: ./Dockerfile + + deploy: + runs-on: ubuntu-latest + needs: build + environment: + name: 'production' + url: ${{ steps.deploy-to-webapp.outputs.webapp-url }} + + steps: + - name: Deploy to Azure Web App + id: deploy-to-webapp + uses: azure/webapps-deploy@v2 + with: + app-name: 'securityshepherd-demo' + slot-name: 'production' + publish-profile: ${{ secrets.AzureAppService_PublishProfile_4acf8a575ee74775ac58925cb01efa2d }} + images: 'mcr.microsoft.com/${{ secrets.AzureAppService_ContainerUsername_bf9962b498a24875ba9d9338e99e414d }}/appsvc/staticsite:${{ github.sha }}' \ No newline at end of file From ad5e3cd9d04f578fe795b0d3463082a97e65e62c Mon Sep 17 00:00:00 2001 From: DataScNina <146072819+DataScNina@users.noreply.github.com> Date: Mon, 2 Jun 2025 12:30:27 +0200 Subject: [PATCH 2/2] Update master_securityshepherd-demo.yml --- .github/workflows/master_securityshepherd-demo.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/master_securityshepherd-demo.yml b/.github/workflows/master_securityshepherd-demo.yml index 7822e0dae..fb1ef1773 100644 --- a/.github/workflows/master_securityshepherd-demo.yml +++ b/.github/workflows/master_securityshepherd-demo.yml @@ -16,6 +16,15 @@ jobs: steps: - uses: actions/checkout@v2 + - name: Set up JDK 11 + uses: actions/setup-java@v3 + with: + java-version: '11' + distribution: 'temurin' + + - name: Build Java project with Maven + run: mvn clean package + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 @@ -33,6 +42,7 @@ jobs: tags: mcr.microsoft.com/${{ secrets.AzureAppService_ContainerUsername_bf9962b498a24875ba9d9338e99e414d }}/appsvc/staticsite:${{ github.sha }} file: ./Dockerfile + deploy: runs-on: ubuntu-latest needs: build @@ -48,4 +58,4 @@ jobs: app-name: 'securityshepherd-demo' slot-name: 'production' publish-profile: ${{ secrets.AzureAppService_PublishProfile_4acf8a575ee74775ac58925cb01efa2d }} - images: 'mcr.microsoft.com/${{ secrets.AzureAppService_ContainerUsername_bf9962b498a24875ba9d9338e99e414d }}/appsvc/staticsite:${{ github.sha }}' \ No newline at end of file + images: 'mcr.microsoft.com/${{ secrets.AzureAppService_ContainerUsername_bf9962b498a24875ba9d9338e99e414d }}/appsvc/staticsite:${{ github.sha }}'