feat: patient education updates #2
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: Deploy to Stage | |
| on: | |
| push: | |
| branches: | |
| - stage | |
| pull_request: | |
| branches: | |
| - stage | |
| workflow_dispatch: | |
| env: | |
| ACR_NAME: hinikubestageacr.azurecr.io | |
| IMAGE_NAME: ciyex-ehr-ui-stage | |
| CLUSTER_NAME: hiniKubeStage | |
| RESOURCE_GROUP: hiniKubeStage-rg | |
| VERSION: v1.0.${{ github.run_number }} | |
| jobs: | |
| pr-checks: | |
| name: PR Checks - Validate Build | |
| if: github.event_name == 'pull_request' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install pnpm | |
| uses: pnpm/action-setup@v2 | |
| with: | |
| version: 9 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '24' | |
| cache: 'pnpm' | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Run linter | |
| run: pnpm run lint | |
| - name: Run type check | |
| run: pnpm run build | |
| - name: Run tests (if available) | |
| run: | | |
| if grep -q '"test"' package.json; then | |
| pnpm run test | |
| else | |
| echo "No tests configured, skipping..." | |
| fi | |
| - name: Build Docker image (no push) | |
| run: | | |
| docker build -t ${{ env.ACR_NAME }}/${{ env.IMAGE_NAME }}:${{ env.VERSION }} . | |
| echo "✅ PR image build successful: ${{ env.ACR_NAME }}/${{ env.IMAGE_NAME }}:${{ env.VERSION }}" | |
| deploy-stage: | |
| name: Deploy to Stage | |
| if: github.ref == 'refs/heads/stage' && github.event_name != 'pull_request' | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: stage | |
| url: https://stg.ciyex.com | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Login to Azure | |
| uses: azure/login@v1 | |
| with: | |
| creds: ${{ secrets.AZURE_CREDENTIALS_STAGE }} | |
| - name: Azure ACR Login | |
| run: az acr login --name hinikubestageacr | |
| - name: Build and Push Docker Image | |
| run: | | |
| docker build -t ${{ env.ACR_NAME }}/${{ env.IMAGE_NAME }}:${{ env.VERSION }} . | |
| docker push ${{ env.ACR_NAME }}/${{ env.IMAGE_NAME }}:${{ env.VERSION }} | |
| echo "✅ Image pushed: ${{ env.ACR_NAME }}/${{ env.IMAGE_NAME }}:${{ env.VERSION }}" | |
| - name: Set AKS context | |
| uses: azure/aks-set-context@v3 | |
| with: | |
| resource-group: ${{ env.RESOURCE_GROUP }} | |
| cluster-name: ${{ env.CLUSTER_NAME }} | |
| - name: Update manifest image tags for deployment | |
| run: | | |
| sed -i "s|newName: IMAGE_URL|newName: ${{ env.ACR_NAME }}/${{ env.IMAGE_NAME }}|g" k8s/overlays/stage/kustomization.yaml | |
| sed -i "s|newTag: IMAGE_TAG|newTag: ${{ env.VERSION }}|g" k8s/overlays/stage/kustomization.yaml | |
| echo "Updated kustomization.yaml:" | |
| cat k8s/overlays/stage/kustomization.yaml | |
| - name: Deploy to Stage | |
| run: kubectl apply -k k8s/overlays/stage/ | |
| - name: Verify deployment | |
| run: | | |
| kubectl rollout status deployment/ciyex-ehr-ui-stage --timeout=3m | |
| kubectl get pods -l app=ciyex-ehr-ui -o wide | |
| - name: Notify deployment | |
| if: always() | |
| run: | | |
| if [ ${{ job.status }} == 'success' ]; then | |
| echo "✅ Stage deployment successful" | |
| else | |
| echo "❌ Stage deployment failed" | |
| fi | |
| notify: | |
| name: Notify Team | |
| if: github.event_name != 'pull_request' && always() | |
| runs-on: ubuntu-latest | |
| needs: [deploy-stage] | |
| steps: | |
| - name: Determine deployment status | |
| id: status | |
| run: | | |
| if [ "${{ needs.deploy-stage.result }}" == "success" ]; then | |
| echo "status=success" >> $GITHUB_OUTPUT | |
| echo "color=good" >> $GITHUB_OUTPUT | |
| echo "emoji=✅" >> $GITHUB_OUTPUT | |
| else | |
| echo "status=failure" >> $GITHUB_OUTPUT | |
| echo "color=danger" >> $GITHUB_OUTPUT | |
| echo "emoji=❌" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Send Microsoft Teams notification | |
| run: | | |
| TEAMS_WEBHOOK="${{ secrets.TEAMS_WEBHOOK_URL }}" | |
| if [ -z "$TEAMS_WEBHOOK" ]; then | |
| echo "⚠️ TEAMS_WEBHOOK_URL secret not configured, skipping notification" | |
| exit 0 | |
| fi | |
| STATUS_COLOR="28a745" | |
| if [ "${{ steps.status.outputs.status }}" == "failure" ]; then | |
| STATUS_COLOR="dc3545" | |
| fi | |
| # Detect if this is a Power Automate webhook or traditional Teams webhook | |
| if [[ "$TEAMS_WEBHOOK" == *"powerautomate"* ]] || [[ "$TEAMS_WEBHOOK" == *"logic.azure.com"* ]]; then | |
| # Power Automate / Logic Apps format with attachments array | |
| CARD_STYLE="good" | |
| if [ "${{ steps.status.outputs.status }}" == "failure" ]; then | |
| CARD_STYLE="attention" | |
| fi | |
| curl -X POST -H "Content-Type: application/json" -d '{ | |
| "attachments": [ | |
| { | |
| "contentType": "application/vnd.microsoft.card.adaptive", | |
| "content": { | |
| "type": "AdaptiveCard", | |
| "$schema": "http://adaptivecards.io/schemas/adaptive-card.json", | |
| "version": "1.4", | |
| "body": [ | |
| { | |
| "type": "Container", | |
| "style": "'"$CARD_STYLE"'", | |
| "items": [ | |
| { | |
| "type": "TextBlock", | |
| "text": "${{ steps.status.outputs.emoji }} Ciyex EHR UI Stage Deployment ${{ steps.status.outputs.status }}", | |
| "weight": "Bolder", | |
| "size": "Large" | |
| }, | |
| { | |
| "type": "TextBlock", | |
| "text": "Version ${{ env.VERSION }}", | |
| "wrap": true | |
| } | |
| ] | |
| }, | |
| { | |
| "type": "FactSet", | |
| "facts": [ | |
| { | |
| "title": "Environment:", | |
| "value": "Stage" | |
| }, | |
| { | |
| "title": "Version:", | |
| "value": "${{ env.VERSION }}" | |
| }, | |
| { | |
| "title": "Image:", | |
| "value": "${{ env.ACR_NAME }}/${{ env.IMAGE_NAME }}:${{ env.VERSION }}" | |
| }, | |
| { | |
| "title": "Cluster:", | |
| "value": "${{ env.CLUSTER_NAME }}" | |
| }, | |
| { | |
| "title": "Deployed by:", | |
| "value": "${{ github.actor }}" | |
| }, | |
| { | |
| "title": "Commit:", | |
| "value": "${{ github.sha }}" | |
| }, | |
| { | |
| "title": "URL:", | |
| "value": "https://stg.ciyex.com" | |
| } | |
| ] | |
| } | |
| ], | |
| "actions": [ | |
| { | |
| "type": "Action.OpenUrl", | |
| "title": "View Workflow", | |
| "url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" | |
| }, | |
| { | |
| "type": "Action.OpenUrl", | |
| "title": "View Application", | |
| "url": "https://stg.ciyex.com" | |
| } | |
| ] | |
| } | |
| } | |
| ] | |
| }' "$TEAMS_WEBHOOK" | |
| else | |
| # Traditional Teams Incoming Webhook format (MessageCard) | |
| curl -H "Content-Type: application/json" -d '{ | |
| "@type": "MessageCard", | |
| "@context": "https://schema.org/extensions", | |
| "themeColor": "'"$STATUS_COLOR"'", | |
| "summary": "Stage Deployment ${{ steps.status.outputs.status }}", | |
| "sections": [{ | |
| "activityTitle": "${{ steps.status.outputs.emoji }} Ciyex EHR UI Stage Deployment ${{ steps.status.outputs.status }}", | |
| "activitySubtitle": "Version ${{ env.VERSION }}", | |
| "facts": [ | |
| { | |
| "name": "Environment:", | |
| "value": "Stage" | |
| }, | |
| { | |
| "name": "Version:", | |
| "value": "${{ env.VERSION }}" | |
| }, | |
| { | |
| "name": "Image:", | |
| "value": "${{ env.ACR_NAME }}/${{ env.IMAGE_NAME }}:${{ env.VERSION }}" | |
| }, | |
| { | |
| "name": "Cluster:", | |
| "value": "${{ env.CLUSTER_NAME }}" | |
| }, | |
| { | |
| "name": "Deployed by:", | |
| "value": "${{ github.actor }}" | |
| }, | |
| { | |
| "name": "Commit:", | |
| "value": "${{ github.sha }}" | |
| }, | |
| { | |
| "name": "URL:", | |
| "value": "https://stg.ciyex.com" | |
| } | |
| ], | |
| "markdown": true | |
| }], | |
| "potentialAction": [{ | |
| "@type": "OpenUri", | |
| "name": "View Workflow", | |
| "targets": [{ | |
| "os": "default", | |
| "uri": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" | |
| }] | |
| }, | |
| { | |
| "@type": "OpenUri", | |
| "name": "View Application", | |
| "targets": [{ | |
| "os": "default", | |
| "uri": "https://stg.ciyex.com" | |
| }] | |
| }] | |
| }' "$TEAMS_WEBHOOK" | |
| fi |