Update main_edually-pilot.yml #4
This file contains 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
You're now in the production slot, which is not recommended for setting up CI/CD.Learn more | ||
Deploy and build code from your preferred source and build provider. Learn more | ||
Source* | ||
Building with GitHub Actions.Change provider. | ||
GitHub | ||
App Service will place a GitHub Actions workflow in your chosen repository to build and deploy your app whenever there is a commit on the chosen branch. If you can't find an organization or repository, you may need to enable additional permissions on GitHub. You must have write access to your chosen GitHub repository to deploy with GitHub Actions. Learn more | ||
Signed in as | ||
lafonsecallorcaChange Account | ||
Organization* | ||
SUNY-Brockport-ACM-Student-Chapter | ||
Repository* | ||
AI-Education-Pilot | ||
Branch* | ||
main | ||
Workflow Option* | ||
Build | ||
Runtime stack | ||
Python | ||
Version | ||
Python 3.10 | ||
Authentication settings | ||
Select how you want your GitHub Action workflow to authenticate to Azure. If you choose user-assigned identity, the identity selected will be federated with GitHub as an authorized client and given write permissions on the app. Learn more | ||
Authentication type* | ||
Subscription* | ||
Azure for Students | ||
Identity* | ||
(Create new) | ||
Workflow Configuration | ||
File with the workflow configuration defined by the settings above. | ||
Workflow Configuration | ||
File path: .github/workflows/main_edually-pilot.yml | ||
If an existing workflow configuration exists, it will be overwritten. | ||
# 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 - edually-pilot | ||
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@v5 | ||
with: | ||
python-version: '3.10' | ||
- 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@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 #This is required for requesting the JWT | ||
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: Login to Azure | ||
uses: azure/login@v2 | ||
with: | ||
client-id: ${{ secrets.__clientidsecretname__ }} | ||
tenant-id: ${{ secrets.__tenantidsecretname__ }} | ||
subscription-id: ${{ secrets.__subscriptionidsecretname__ }} | ||
- name: 'Deploy to Azure Web App' | ||
uses: azure/webapps-deploy@v3 | ||
id: deploy-to-webapp | ||
with: | ||
app-name: 'edually-pilot' | ||
slot-name: 'Production' | ||