| |
| |
| |
| |
|
|
| |
| |
| |
|
|
| name: Build and deploy Python app to Azure Web App |
|
|
| env: |
| AZURE_WEBAPP_NAME: MY_WEBAPP_NAME |
| PYTHON_VERSION: '3.8' |
|
|
| on: |
| push: |
| branches: |
| - main |
|
|
| jobs: |
| build: |
| runs-on: ubuntu-latest |
|
|
| steps: |
| - uses: actions/checkout@v4 |
|
|
| - name: Set up Python version |
| uses: actions/setup-python@v5 |
| with: |
| python-version: ${{ env.PYTHON_VERSION }} |
|
|
| - name: Create and start virtual environment |
| run: | |
| python -m venv venv |
| source venv/bin/activate |
| |
| - name: Set up dependency caching for faster installs |
| uses: actions/cache@v3 |
| with: |
| path: ~/.cache/pip |
| key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} |
| restore-keys: | |
| ${{ runner.os }}-pip- |
| |
| - name: Install dependencies |
| run: pip install -r requirements.txt |
|
|
| |
|
|
| - name: Upload artifact for deployment jobs |
| uses: actions/upload-artifact@v4 |
| with: |
| name: python-app |
| path: | |
| . |
| !venv/ |
| deploy: |
| runs-on: ubuntu-latest |
| needs: build |
| environment: |
| name: 'production' |
| url: ${{ steps.deploy-to-webapp.outputs.webapp-url }} |
|
|
| steps: |
| - name: Download artifact from build job |
| uses: actions/download-artifact@v4 |
| with: |
| name: python-app |
| path: . |
|
|
| - name: 'Deploy to Azure Web App' |
| id: deploy-to-webapp |
| uses: azure/webapps-deploy@85270a1854658d167ab239bce43949edb336fa7c |
| with: |
| app-name: ${{ env.AZURE_WEBAPP_NAME }} |
| publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }} |
|
|
| |
| |
| |
| |
|
|
| |
| |
| |
|
|
| on: |
| push: |
| branches: |
| - main |
|
|
| env: |
| AZURE_WEBAPP_NAME: MY_WEBAPP_NAME |
| AZURE_WEBAPP_PACKAGE_PATH: '.' |
| NODE_VERSION: '14.x' |
|
|
| jobs: |
| build: |
| runs-on: ubuntu-latest |
| steps: |
| - uses: actions/checkout@v4 |
|
|
| - name: Set up Node.js |
| uses: actions/setup-node@v4 |
| with: |
| node-version: ${{ env.NODE_VERSION }} |
| cache: 'npm' |
|
|
| - name: npm install, build, and test |
| run: | |
| npm install |
| npm run build --if-present |
| npm run test --if-present |
| - name: Upload artifact for deployment job |
| uses: actions/upload-artifact@v4 |
| with: |
| name: node-app |
| path: . |
|
|
| deploy: |
| runs-on: ubuntu-latest |
| needs: build |
| environment: |
| name: 'production' |
| url: ${{ steps.deploy-to-webapp.outputs.webapp-url }} |
|
|
| steps: |
| - name: Download artifact from build job |
| uses: actions/download-artifact@v4 |
| with: |
| name: node-app |
|
|
| - name: 'Deploy to Azure WebApp' |
| id: deploy-to-webapp |
| uses: azure/webapps-deploy@85270a1854658d167ab239bce43949edb336fa7c |
| with: |
| app-name: ${{ env.AZURE_WEBAPP_NAME }} |
| publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }} |
| package: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }} |
|
|