From f8dda45a9aa8f98781ef37f75a53c15302be1451 Mon Sep 17 00:00:00 2001 From: thiennatra Date: Wed, 15 Apr 2026 16:42:46 +0700 Subject: [PATCH] Update ci-cd.yml --- .github/workflows/ci-cd.yml | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index eb06a49..c2fce3a 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -1,12 +1,10 @@ name: CI-CD run-name: >- - ${{ github.event_name == 'pull_request' && format('Merge PR #{0}: {1}', github.event.pull_request.number, github.event.pull_request.title) || format('Manual run by {0}', github.actor) }} + ${{ format('Main deploy: {0}', github.sha) }} on: - pull_request: - types: [closed] + push: branches: ["main"] - workflow_dispatch: permissions: contents: read @@ -14,7 +12,6 @@ permissions: jobs: quality-gate: runs-on: ubuntu-latest - if: ${{ github.event_name == 'workflow_dispatch' || github.event.pull_request.merged == true }} steps: - uses: actions/checkout@v4 @@ -46,15 +43,13 @@ jobs: name: Deploy Gate runs-on: ubuntu-latest needs: [quality-gate] - if: ${{ github.event_name == 'workflow_dispatch' || github.event.pull_request.merged == true }} steps: - - run: echo "Ready for build/push (merge or manual trigger)" + - run: echo "Ready for build/push on main" build-and-push: name: Build and Push Docker runs-on: ubuntu-latest needs: [deploy-gate] - if: ${{ github.event_name == 'workflow_dispatch' || github.event.pull_request.merged == true }} permissions: contents: read packages: write @@ -74,7 +69,7 @@ jobs: - name: Extract version id: version run: | - SHORT_SHA=$(echo ${{ github.event.pull_request.merge_commit_sha || github.sha }} | cut -c1-7) + SHORT_SHA=$(echo ${{ github.sha }} | cut -c1-7) VERSION="staging-${SHORT_SHA}" REGISTRY_IMAGE="ghcr.io/$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')/${{ matrix.service }}" echo "version=${VERSION}" >> $GITHUB_OUTPUT