From 2b70249705d74124ff1deca4f5b2ce9570f0be94 Mon Sep 17 00:00:00 2001 From: Anil kumar <50286337+anilyadav106@users.noreply.github.com> Date: Mon, 9 Dec 2024 12:47:25 +0530 Subject: [PATCH 1/3] Add or update the Azure App Service build and deployment workflow config --- .github/workflows/main_mywebappnagp.yml | 63 +++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 .github/workflows/main_mywebappnagp.yml diff --git a/.github/workflows/main_mywebappnagp.yml b/.github/workflows/main_mywebappnagp.yml new file mode 100644 index 000000000..b3017c482 --- /dev/null +++ b/.github/workflows/main_mywebappnagp.yml @@ -0,0 +1,63 @@ +# 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 WAR app to Azure Web App - mywebappnagp + +on: + push: + branches: + - main + workflow_dispatch: + +jobs: + build: + runs-on: windows-latest + + steps: + - uses: actions/checkout@v4 + + - name: Set up Java version + uses: actions/setup-java@v4 + with: + java-version: '8' + distribution: 'microsoft' + + - name: Build with Maven + run: mvn clean install + + - name: Upload artifact for deployment job + uses: actions/upload-artifact@v4 + with: + name: java-app + path: '${{ github.workspace }}/target/*.war' + + deploy: + runs-on: windows-latest + needs: build + environment: + name: 'Production' + url: ${{ steps.deploy-to-webapp.outputs.webapp-url }} + permissions: + id-token: write #This is required for requesting the JWT + + steps: + - name: Download artifact from build job + uses: actions/download-artifact@v4 + with: + name: java-app + + - name: Login to Azure + uses: azure/login@v2 + with: + client-id: ${{ secrets.AZUREAPPSERVICE_CLIENTID_47C17E5693CE450DBCF773DC9937A372 }} + tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID_B03CF3F8438949A490B372C6DA4327BA }} + subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_88629701582644C2BA7C5A0CCCF94906 }} + + - name: Deploy to Azure Web App + id: deploy-to-webapp + uses: azure/webapps-deploy@v3 + with: + app-name: 'mywebappnagp' + slot-name: 'Production' + package: '*.war' + \ No newline at end of file From ce7bb07e3b3228f3aa45735c6a5fcc450d12111f Mon Sep 17 00:00:00 2001 From: Anil kumar <50286337+anilyadav106@users.noreply.github.com> Date: Mon, 9 Dec 2024 14:56:46 +0530 Subject: [PATCH 2/3] Add or update the Azure App Service build and deployment workflow config --- .github/workflows/main_mywebappnagp.yml | 53 ++++++++++++++++--------- 1 file changed, 34 insertions(+), 19 deletions(-) diff --git a/.github/workflows/main_mywebappnagp.yml b/.github/workflows/main_mywebappnagp.yml index b3017c482..9751b0c50 100644 --- a/.github/workflows/main_mywebappnagp.yml +++ b/.github/workflows/main_mywebappnagp.yml @@ -1,7 +1,8 @@ # Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy # More GitHub Actions for Azure: https://github.com/Azure/actions +# More info on Python, GitHub Actions, and Azure App Service: https://aka.ms/python-webapps-actions -name: Build and deploy WAR app to Azure Web App - mywebappnagp +name: Build and deploy Python app to Azure Web App - mywebappnagp on: push: @@ -11,28 +12,39 @@ on: jobs: build: - runs-on: windows-latest + runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - name: Set up Java version - uses: actions/setup-java@v4 + - name: Set up Python version + uses: actions/setup-python@v5 with: - java-version: '8' - distribution: 'microsoft' + python-version: '3.9' - - name: Build with Maven - run: mvn clean install + - name: Create and start virtual environment + run: | + python -m venv venv + source venv/bin/activate + + - name: Install dependencies + run: pip install -r requirements.txt + + # Optional: Add step to run tests here (PyTest, Django test suites, etc.) - - name: Upload artifact for deployment job + - name: Zip artifact for deployment + run: zip release.zip ./* -r + + - name: Upload artifact for deployment jobs uses: actions/upload-artifact@v4 with: - name: java-app - path: '${{ github.workspace }}/target/*.war' + name: python-app + path: | + release.zip + !venv/ deploy: - runs-on: windows-latest + runs-on: ubuntu-latest needs: build environment: name: 'Production' @@ -44,20 +56,23 @@ jobs: - name: Download artifact from build job uses: actions/download-artifact@v4 with: - name: java-app + name: python-app + + - name: Unzip artifact for deployment + run: unzip release.zip + - name: Login to Azure uses: azure/login@v2 with: - client-id: ${{ secrets.AZUREAPPSERVICE_CLIENTID_47C17E5693CE450DBCF773DC9937A372 }} - tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID_B03CF3F8438949A490B372C6DA4327BA }} - subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_88629701582644C2BA7C5A0CCCF94906 }} + client-id: ${{ secrets.AZUREAPPSERVICE_CLIENTID_203F1E8F0CC54401B01AB1EC4BA7EA9B }} + tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID_B38B8D15E8BA4B31980078CD0A37A54D }} + subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_32A37270E7B5413E8093DC76C25D218F }} - - name: Deploy to Azure Web App - id: deploy-to-webapp + - name: 'Deploy to Azure Web App' uses: azure/webapps-deploy@v3 + id: deploy-to-webapp with: app-name: 'mywebappnagp' slot-name: 'Production' - package: '*.war' \ No newline at end of file From 6a81a5114d71d073693c7d7f422cefbf28abc78d Mon Sep 17 00:00:00 2001 From: Anil kumar <50286337+anilyadav106@users.noreply.github.com> Date: Mon, 9 Dec 2024 15:24:37 +0530 Subject: [PATCH 3/3] Add or update the Azure App Service build and deployment workflow config --- .github/workflows/main_mywebappnagp.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main_mywebappnagp.yml b/.github/workflows/main_mywebappnagp.yml index 9751b0c50..77138a1b2 100644 --- a/.github/workflows/main_mywebappnagp.yml +++ b/.github/workflows/main_mywebappnagp.yml @@ -65,9 +65,9 @@ jobs: - name: Login to Azure uses: azure/login@v2 with: - client-id: ${{ secrets.AZUREAPPSERVICE_CLIENTID_203F1E8F0CC54401B01AB1EC4BA7EA9B }} - tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID_B38B8D15E8BA4B31980078CD0A37A54D }} - subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_32A37270E7B5413E8093DC76C25D218F }} + client-id: ${{ secrets.AZUREAPPSERVICE_CLIENTID_1932EF3D0F3F490EAA311A6CCD5D53A6 }} + tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID_669F836DC0CA4824A5D5272A1D68D1FE }} + subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_1E0E4C73EA484362A02AC86216A1CD47 }} - name: 'Deploy to Azure Web App' uses: azure/webapps-deploy@v3