Update dashboard.html #140
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build and deploy Python app to Azure Web App - EOAgriTool | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - github | |
| - gh-pages | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read # Required for actions/checkout | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python version | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.9' | |
| - name: Create and start virtual environment | |
| run: | | |
| python -m venv venv | |
| source venv/bin/activate | |
| - name: Install Python dependencies | |
| run: pip install -r requirements.txt | |
| - name: Zip artifact for deployment | |
| run: zip release.zip ./* -r | |
| - name: Upload artifact for deployment jobs | |
| uses: actions/upload-artifact@v4 | |
| 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 # Required for requesting the JWT | |
| contents: read # Required for actions/checkout | |
| steps: | |
| - name: Download artifact from build job | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: python-app | |
| - name: Unzip artifact for deployment | |
| run: unzip release.zip | |
| - name: Select Azure Credentials | |
| run: | | |
| echo "Using first set of credentials" | |
| echo "AZURE_CLIENT_ID=${{ secrets.AZUREAPPSERVICE_CLIENTID_4B2AA51C8F3E408F929B19AAB9401302 }}" >> $GITHUB_ENV | |
| echo "AZURE_TENANT_ID=${{ secrets.AZUREAPPSERVICE_TENANTID_39535BE70D534ABDB745C9214BE55081 }}" >> $GITHUB_ENV | |
| echo "AZURE_SUBSCRIPTION_ID=${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_932529A45BB3430AA83B922DBBC83617 }}" >> $GITHUB_ENV | |
| - name: Debug Azure Credentials | |
| run: | | |
| echo "Client ID: $AZURE_CLIENT_ID" | |
| echo "Tenant ID: $AZURE_TENANT_ID" | |
| echo "Subscription ID: $AZURE_SUBSCRIPTION_ID" | |
| - name: Login to Azure | |
| uses: azure/login@v1 | |
| with: | |
| client-id: ${{ env.AZURE_CLIENT_ID }} | |
| tenant-id: ${{ env.AZURE_TENANT_ID }} | |
| subscription-id: ${{ env.AZURE_SUBSCRIPTION_ID }} | |
| - name: Deploy to Azure Web App | |
| uses: azure/webapps-deploy@v3 | |
| id: deploy-to-webapp | |
| with: | |
| app-name: 'EOAgriTool' | |
| slot-name: 'Production' | |
| publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }} | |
| nodejs: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code from GitHub branch | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: github | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: '18.20.3' | |
| - name: Install Node.js dependencies | |
| run: npm install | |
| - name: Run Node.js API | |
| run: npm start | |
| gh-pages: | |
| runs-on: ubuntu-latest | |
| needs: build | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Deploy to GitHub Pages | |
| uses: peaceiris/actions-gh-pages@v4 | |
| with: | |
| github_token: ${{ secrets.PAT_TOKEN }} | |
| publish_branch: gh-pages | |
| publish_dir: . # Change if static files are in another directory |