Skip to content

Merge pull request #50 from DevOps2025Group1/student_context #21

Merge pull request #50 from DevOps2025Group1/student_context

Merge pull request #50 from DevOps2025Group1/student_context #21

Workflow file for this run

name: Trigger auto deployment for studentwhisperercontainer
# When this action will be executed
on:
# Automatically trigger it when detected changes in repo
push:
branches: [main]
# Allow manual trigger
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
build-and-deploy:
runs-on: ubuntu-latest
permissions:
id-token: write #This is required for requesting the OIDC JWT Token
contents: read #Required when GH token is used to authenticate with private repo
steps:
- name: Checkout to the branch
uses: actions/checkout@v2
- name: Create .env file
run: |
echo "AZURE_OPENAI_API_KEY=${{ secrets.AZURE_OPENAI_API_KEY }}" >> .env
echo "AZURE_OPENAI_ENDPOINT=${{ secrets.AZURE_OPENAI_ENDPOINT }}" >> .env
echo "AZURE_OPENAI_EMBEDDING_DEPLOYMENT_ID=${{ secrets.AZURE_OPENAI_EMBEDDING_DEPLOYMENT_ID }}" >> .env
echo "AZURE_OPENAI_GPT_MODEL_DEPLOYMENT_ID=${{ secrets.AZURE_OPENAI_GPT_MODEL_DEPLOYMENT_ID }}" >> .env
echo "AZURE_OPENAI_API_VERSION=${{ secrets.AZURE_OPENAI_API_VERSION }}" >> .env
echo "AZURE_SEARCH_SERVICE_ENDPOINT=${{ secrets.AZURE_SEARCH_SERVICE_ENDPOINT }}" >> .env
echo "AZURE_SEARCH_INDEX=${{ secrets.AZURE_SEARCH_INDEX }}" >> .env
echo "AZURE_SEARCH_DATASOURCE=${{ secrets.AZURE_SEARCH_DATASOURCE }}" >> .env
echo "AZURE_SEARCH_SKILLSET=${{ secrets.AZURE_SEARCH_SKILLSET }}" >> .env
echo "AZURE_SEARCH_INDEXER=${{ secrets.AZURE_SEARCH_INDEXER }}" >> .env
echo "AZURE_SEARCH_ADMIN_KEY=${{ secrets.AZURE_SEARCH_ADMIN_KEY }}" >> .env
echo "AZURE_SEARCH_SEMANTIC_CONFIG=${{ secrets.AZURE_SEARCH_SEMANTIC_CONFIG }}" >> .env
- name: Create secrets.toml
run: |
echo 'server="${{ secrets.SERVER }}"' >> .streamlit/secrets.toml
echo 'database="${{ secrets.DATABASE }}"' >> .streamlit/secrets.toml
echo 'username="${{ secrets.DB_USERNAME }}"' >> .streamlit/secrets.toml
echo 'password="${{ secrets.DB_PASSWORD }}"' >> .streamlit/secrets.toml
- name: Azure Login
uses: azure/login@v1
with:
client-id: ${{ secrets.STUDENTWHISPERERCONTAINER_AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.STUDENTWHISPERERCONTAINER_AZURE_TENANT_ID }}
subscription-id: ${{ secrets.STUDENTWHISPERERCONTAINER_AZURE_SUBSCRIPTION_ID }}
- name: Build and push container image to registry
uses: azure/container-apps-deploy-action@v2
with:
appSourcePath: ${{ github.workspace }}
_dockerfilePathKey_: _dockerfilePath_
registryUrl: devopsstudentwhisperer.azurecr.io
registryUsername: ${{ secrets.STUDENTWHISPERERCONTAINER_REGISTRY_USERNAME }}
registryPassword: ${{ secrets.STUDENTWHISPERERCONTAINER_REGISTRY_PASSWORD }}
containerAppName: studentwhisperercontainer
resourceGroup: devops-student-portal-app-rg
imageToBuild: devopsstudentwhisperer.azurecr.io/studentwhisperercontainer:${{ github.sha }}
_buildArgumentsKey_: |
_buildArgumentsValues_