refactor: UI refactoring #184
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 Docker and Optional Push - Content Generation Solution Accelerator | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - dev | |
| - demo | |
| paths: | |
| - 'src/backend/**' | |
| - 'src/app/**' | |
| - 'src/app/server/**' | |
| - '.github/workflows/docker-build.yml' | |
| pull_request: | |
| types: | |
| - opened | |
| - ready_for_review | |
| - reopened | |
| - synchronize | |
| branches: | |
| - main | |
| - dev | |
| - demo | |
| paths: | |
| - 'src/backend/**' | |
| - 'src/app/**' | |
| - 'src/app/server/**' | |
| - '.github/workflows/docker-build.yml' | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| actions: read | |
| id-token: write # Required for OIDC-based Azure authentication | |
| jobs: | |
| build-and-push: | |
| runs-on: ubuntu-latest | |
| environment: production | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to Azure (OIDC) | |
| if: ${{ (github.event_name == 'push' && (github.ref_name == 'main' || github.ref_name == 'dev' || github.ref_name == 'demo')) || (github.event_name == 'workflow_dispatch' && (github.ref_name == 'dependabotchanges'||github.ref_name == 'main' || github.ref_name == 'dev' || github.ref_name == 'demo')) }} | |
| uses: azure/login@v2 | |
| with: | |
| client-id: ${{ secrets.AZURE_CLIENT_ID }} | |
| tenant-id: ${{ secrets.AZURE_TENANT_ID }} | |
| subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | |
| - name: Log in to Azure Container Registry | |
| if: ${{ (github.event_name == 'push' && (github.ref_name == 'main' || github.ref_name == 'dev' || github.ref_name == 'demo')) || (github.event_name == 'workflow_dispatch' && (github.ref_name == 'dependabotchanges'||github.ref_name == 'main' || github.ref_name == 'dev' || github.ref_name == 'demo')) }} | |
| shell: bash | |
| run: az acr login --name ${{ secrets.ACR_LOGIN_SERVER }} | |
| - name: Get current date | |
| id: date | |
| run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT | |
| - name: Output ACR Login Server | |
| run: | | |
| echo "ACR Login Server: ${{ secrets.ACR_LOGIN_SERVER }}" | |
| - name: Determine Tag Name Based on Branch | |
| id: determine_tag | |
| run: | | |
| if [[ "${{ github.ref_name }}" == "main" ]]; then | |
| echo "tagname=latest" >> $GITHUB_OUTPUT | |
| elif [[ "${{ github.ref_name }}" == "dev" ]]; then | |
| echo "tagname=dev" >> $GITHUB_OUTPUT | |
| elif [[ "${{ github.ref_name }}" == "demo" ]]; then | |
| echo "tagname=demo" >> $GITHUB_OUTPUT | |
| elif [[ "${{ github.ref_name }}" == "dependabotchanges" ]]; then | |
| echo "tagname=dependabotchanges" >> $GITHUB_OUTPUT | |
| else | |
| echo "tagname=default" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Build and Push Docker Image for Frontend Server | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: ./src/app | |
| file: ./src/app/WebApp.Dockerfile | |
| push: ${{ github.ref_name == 'main' || github.ref_name == 'dev' || github.ref_name == 'demo' || github.ref_name == 'dependabotchanges' }} | |
| tags: | | |
| ${{ secrets.ACR_LOGIN_SERVER || 'acrlogin.azurecr.io' }}/content-gen-app:${{ steps.determine_tag.outputs.tagname }} | |
| ${{ secrets.ACR_LOGIN_SERVER || 'acrlogin.azurecr.io' }}/content-gen-app:${{ steps.determine_tag.outputs.tagname }}_${{ steps.date.outputs.date }}_${{ github.run_number }} | |
| - name: Build and Push Docker Image for Backend Server | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: ./src/backend | |
| file: ./src/backend/ApiApp.Dockerfile | |
| push: ${{ github.ref_name == 'main' || github.ref_name == 'dev' || github.ref_name == 'demo' || github.ref_name == 'dependabotchanges' }} | |
| tags: | | |
| ${{ secrets.ACR_LOGIN_SERVER || 'acrlogin.azurecr.io' }}/content-gen-api:${{ steps.determine_tag.outputs.tagname }} | |
| ${{ secrets.ACR_LOGIN_SERVER || 'acrlogin.azurecr.io' }}/content-gen-api:${{ steps.determine_tag.outputs.tagname }}_${{ steps.date.outputs.date }}_${{ github.run_number }} |