From 92cd712bce8f5c045cce531c7de517f229d90da1 Mon Sep 17 00:00:00 2001 From: kiendnt Date: Fri, 13 Feb 2026 11:02:59 +0700 Subject: [PATCH] fix:update CD --- .../{cd-prod.yml => cd-publish-image.yml} | 24 +++----------- .github/workflows/dispatch-release.yml | 33 ------------------- 2 files changed, 5 insertions(+), 52 deletions(-) rename .github/workflows/{cd-prod.yml => cd-publish-image.yml} (62%) delete mode 100644 .github/workflows/dispatch-release.yml diff --git a/.github/workflows/cd-prod.yml b/.github/workflows/cd-publish-image.yml similarity index 62% rename from .github/workflows/cd-prod.yml rename to .github/workflows/cd-publish-image.yml index 038d307..05b6e77 100644 --- a/.github/workflows/cd-prod.yml +++ b/.github/workflows/cd-publish-image.yml @@ -1,25 +1,13 @@ -name: Build & Deploy to PROD +name: Publish Docker Image on: release: types: [published] branches: [main] - workflow_call: - inputs: - tag_name: - description: Docker image tag / Release tag - required: true - type: string - target_commitish: - description: Branch to build from - required: true - type: string - jobs: deploy: - if: ${{ inputs.target_commitish == 'main' || github.event.release.target_commitish == 'main' }} - name: Build & Deploy + name: Build & Push Docker Image runs-on: ubuntu-latest permissions: @@ -27,7 +15,7 @@ jobs: packages: write env: - RELEASE_TAG: ${{ inputs.tag_name || github.event.release.tag_name }} + RELEASE_TAG: ${{ github.event.release.tag_name }} steps: - name: Checkout code @@ -49,17 +37,15 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Generate Docker metadata + - name: Generate Docker Metadata id: meta uses: docker/metadata-action@v5 with: images: ghcr.io/${{ github.repository }} tags: | type=semver,pattern={{version}},value=${{ env.RELEASE_TAG }} - type=semver,pattern={{major}}.{{minor}},value=${{ env.RELEASE_TAG }} - type=semver,pattern={{major}},value=${{ env.RELEASE_TAG }} - - name: Build & Push Docker image + - name: Build & Push Docker Image uses: docker/build-push-action@v5 with: context: . diff --git a/.github/workflows/dispatch-release.yml b/.github/workflows/dispatch-release.yml deleted file mode 100644 index 2bd6d32..0000000 --- a/.github/workflows/dispatch-release.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: Dispatch Release & Deploy to PROD -on: - repository_dispatch: - types: - - release-mpa-service - -jobs: - create-release: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v6 - - - name: Client payload - run: | - cat <<'EOF' - ${{ toJson(github.event.client_payload) }} - EOF - - - name: Release - if: ${{ github.event.client_payload.release_target_commitish == 'main' }} - uses: softprops/action-gh-release@v2 - with: - tag_name: ${{ github.event.client_payload.release_tag }} - generate_release_notes: true - target_commitish: 'main' - - deploy-prod: - uses: ./.github/workflows/cd-prod.yml - needs: [create-release] - with: - tag_name: ${{ github.event.client_payload.release_tag }} - target_commitish: ${{ github.event.client_payload.release_target_commitish }}