From 56f3e7138fe75a4e268815978537dd70fa3ce021 Mon Sep 17 00:00:00 2001 From: Janik Baumer Date: Wed, 3 Jul 2024 08:42:21 +0200 Subject: [PATCH 1/3] activate debug --- app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app.py b/app.py index 3d1808cf6..d6010f9d0 100644 --- a/app.py +++ b/app.py @@ -29,4 +29,4 @@ def hello(): if __name__ == '__main__': - app.run() + app.run(debug=True) From a47992e1407be2fbc40c81d356c7aacc64ff79de Mon Sep 17 00:00:00 2001 From: janikbaumer <78206840+janikbaumer@users.noreply.github.com> Date: Wed, 3 Jul 2024 10:34:38 +0200 Subject: [PATCH 2/3] Add or update the Azure App Service build and deployment workflow config --- .github/workflows/main_ms-demo.yml | 78 ++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 .github/workflows/main_ms-demo.yml diff --git a/.github/workflows/main_ms-demo.yml b/.github/workflows/main_ms-demo.yml new file mode 100644 index 000000000..85b04984c --- /dev/null +++ b/.github/workflows/main_ms-demo.yml @@ -0,0 +1,78 @@ +# 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 Python app to Azure Web App - ms-demo + +on: + push: + branches: + - main + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python version + uses: actions/setup-python@v1 + with: + python-version: '3.9' + + - 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: Zip artifact for deployment + run: zip release.zip ./* -r + + - name: Upload artifact for deployment jobs + uses: actions/upload-artifact@v3 + with: + name: python-app + path: | + release.zip + !venv/ + + deploy: + runs-on: ubuntu-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@v3 + with: + name: python-app + + - name: Unzip artifact for deployment + run: unzip release.zip + + + - name: Login to Azure + uses: azure/login@v1 + with: + client-id: ${{ secrets.AZUREAPPSERVICE_CLIENTID_056D533A0DE348E3B125A2B3FD42D405 }} + tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID_1764A80B4CC64787A8E006FF24ADDEF6 }} + subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_F166FBFE205346BE92524849887F7459 }} + + - name: 'Deploy to Azure Web App' + uses: azure/webapps-deploy@v2 + id: deploy-to-webapp + with: + app-name: 'ms-demo' + slot-name: 'Production' + \ No newline at end of file From 43f739817f703dba7d19e442bfc0b7029a3d8f63 Mon Sep 17 00:00:00 2001 From: janikbaumer <78206840+janikbaumer@users.noreply.github.com> Date: Wed, 3 Jul 2024 20:51:34 +0200 Subject: [PATCH 3/3] Add or update the Azure App Service build and deployment workflow config --- .github/workflows/main_ms-demooo.yml | 78 ++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 .github/workflows/main_ms-demooo.yml diff --git a/.github/workflows/main_ms-demooo.yml b/.github/workflows/main_ms-demooo.yml new file mode 100644 index 000000000..e8cad17fd --- /dev/null +++ b/.github/workflows/main_ms-demooo.yml @@ -0,0 +1,78 @@ +# 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 Python app to Azure Web App - ms-demooo + +on: + push: + branches: + - main + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python version + uses: actions/setup-python@v1 + with: + python-version: '3.9' + + - 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: Zip artifact for deployment + run: zip release.zip ./* -r + + - name: Upload artifact for deployment jobs + uses: actions/upload-artifact@v3 + with: + name: python-app + path: | + release.zip + !venv/ + + deploy: + runs-on: ubuntu-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@v3 + with: + name: python-app + + - name: Unzip artifact for deployment + run: unzip release.zip + + + - name: Login to Azure + uses: azure/login@v1 + with: + client-id: ${{ secrets.AZUREAPPSERVICE_CLIENTID_7443A9DC882E404AA747202EC3B5EE91 }} + tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID_07C986F4AFD54383B421932BE8791183 }} + subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_6D4AFAAF21D94022AFDAD29484AE4A62 }} + + - name: 'Deploy to Azure Web App' + uses: azure/webapps-deploy@v2 + id: deploy-to-webapp + with: + app-name: 'ms-demooo' + slot-name: 'Production' + \ No newline at end of file