From 681184603acdf730579d341cb5d18ea201ad34d2 Mon Sep 17 00:00:00 2001 From: Mohamad Choupan Date: Mon, 11 Nov 2024 20:30:00 +0330 Subject: [PATCH] fix: workflow front --- .github/workflows/go.yaml | 2 +- .github/workflows/ui.yaml | 22 ++++++---------------- 2 files changed, 7 insertions(+), 17 deletions(-) diff --git a/.github/workflows/go.yaml b/.github/workflows/go.yaml index 8f5bcd526..8487ba321 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.pull_request.head.ref != 'ui-changes'&& 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') && ( ! contains(github.event.head_commit.message, 'ui-changes') ) steps: - name: Checkout code uses: actions/checkout@v3 diff --git a/.github/workflows/ui.yaml b/.github/workflows/ui.yaml index cdf3886ea..33dcd0bb0 100644 --- a/.github/workflows/ui.yaml +++ b/.github/workflows/ui.yaml @@ -1,24 +1,14 @@ name: Web UI Build on: - workflow_dispatch: - inputs: - deployTo: - type: choice - description: "Environment to deploy to" - options: - - "dev" - - "prod" - default: "dev" push: - branches: [ "main" ] - pull_request: - branches: [ "main" ] # This will trigger on PRs targeting the `main` branch + branches: + - main # Only run this workflow on pushes to the main branch jobs: build: - if: github.event.pull_request.head.ref == 'ui-changes' - environment: web + # Check if the last commit is a merge from the `ui-changes` branch + if: contains(github.event.head_commit.message, 'Merge pull request') && contains(github.event.head_commit.message, 'ui-changes') runs-on: ubuntu-latest permissions: id-token: write @@ -71,7 +61,7 @@ jobs: uses: docker/setup-buildx-action@v2 - name: Log in to the Container Registry - uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 + uses: docker/login-action@v2 with: registry: ghcr.io username: ${{ github.actor }} @@ -84,7 +74,7 @@ jobs: push: true platforms: linux/amd64,linux/arm64 tags: | - ghcr.io/${{ github.repository_owner }}/web-ui:${{ steps.tag_version.outputs.new_tag }}-${{ github.event.inputs.deployTo || 'dev' }} + ghcr.io/${{ github.repository_owner }}/web-ui:${{ steps.tag_version.outputs.new_tag }} file: docker/WebUiDockerfile cache-from: type=gha cache-to: type=gha,mode=max