diff --git a/.github/workflows/go.yaml b/.github/workflows/go.yaml index 26affdbb7..8cfe82f2b 100644 --- a/.github/workflows/go.yaml +++ b/.github/workflows/go.yaml @@ -36,7 +36,7 @@ jobs: environment: golang outputs: latest_tag: ${{ steps.set_latest_tag.outputs.latest_tag }} - if: github.event_name != 'pull_request' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev') + if: github.event_name != 'pull_request' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev') && github.event.pull_request.head.ref != 'ui-changes' steps: - name: Checkout code uses: actions/checkout@v3 diff --git a/.github/workflows/ui.yaml b/.github/workflows/ui.yaml index b822fc2e6..5cc74da53 100644 --- a/.github/workflows/ui.yaml +++ b/.github/workflows/ui.yaml @@ -12,9 +12,12 @@ on: default: "dev" push: branches: [ "main" ] + pull_request: + branches: [ "main" ] # This will trigger on PRs targeting the `main` branch jobs: build: + if: ${{ github.event.pull_request.head.ref == 'ui-changes' || github.event_name != 'pull_request' }} environment: web runs-on: ubuntu-latest permissions: @@ -35,7 +38,7 @@ jobs: uses: actions/setup-node@v3 with: node-version: 20.x - + - name: NPM Cache uses: actions/cache@v3 with: @@ -46,36 +49,42 @@ jobs: key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} restore-keys: | ${{ runner.os }}-npm- - - name: Go To Code directory - run : cd services/web-ui - - name: check dir - run : ls - - - name: Install dependencies + + - name: Go to Code Directory + working-directory: services/web-ui + run: | + echo "Navigating to code directory..." + pwd + ls + + - name: Install Dependencies run: npm install + working-directory: services/web-ui - name: Build env: CI: false run: npm run build + working-directory: services/web-ui - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 - - name: Log in to the Container registry - uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 + + - name: Log in to the Container Registry + uses: docker/login-action@v2 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GHCR_PAT }} - - name: Build and push Docker images + + - name: Build and Push Docker Image uses: docker/build-push-action@v4 with: - context: . + context: ./services/web-ui push: ${{ github.event_name != 'pull_request' }} - platforms: linux/amd64,linux/arm64 # Add multi-platform support - - tags: - ghcr.io/${{ github.repository_owner }}/web-ui:${{ steps.tag_version.outputs.new_tag }}-${{ github.event.inputs.deployTo == '' && 'dev' || github.event.inputs.deployTo }} + platforms: linux/amd64,linux/arm64 + tags: | + ghcr.io/${{ github.repository_owner }}/web-ui:${{ steps.tag_version.outputs.new_tag }}-${{ github.event.inputs.deployTo || 'dev' }} file: docker/WebUiDockerfile cache-from: type=gha - cache-to: type=gha,mode=max \ No newline at end of file + cache-to: type=gha,mode=max