diff --git a/.github/workflows/master_securityshepherd-demo.yml b/.github/workflows/master_securityshepherd-demo.yml new file mode 100644 index 000000000..fb1ef1773 --- /dev/null +++ b/.github/workflows/master_securityshepherd-demo.yml @@ -0,0 +1,61 @@ +# 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 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 + + - 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 }}'