From 0716b20bbf8c391321c6630e65ada5c18caf047d Mon Sep 17 00:00:00 2001 From: Mayank Pande Date: Tue, 12 May 2026 15:37:50 +0530 Subject: [PATCH] ci: consolidate image-build workflow for single-branch model MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Merges build-image-dev.yaml and build-image-prod.yaml into a single build-image.yaml. With prod gone, the dev-/prod- tag prefixes lose meaning. Tag scheme: push: main (or workflow_dispatch) → ghcr.io/nudgebee/nova:_ push: tags v* → ghcr.io/nudgebee/nova: (e.g. v0.1.0) The prod-branch trigger is removed; releases are cut as semver tags on main rather than promotions to a long-lived prod branch. --- .github/workflows/build-image-prod.yaml | 40 ------------------- ...{build-image-dev.yaml => build-image.yaml} | 16 +++++--- 2 files changed, 11 insertions(+), 45 deletions(-) delete mode 100644 .github/workflows/build-image-prod.yaml rename .github/workflows/{build-image-dev.yaml => build-image.yaml} (63%) diff --git a/.github/workflows/build-image-prod.yaml b/.github/workflows/build-image-prod.yaml deleted file mode 100644 index bc58a0e..0000000 --- a/.github/workflows/build-image-prod.yaml +++ /dev/null @@ -1,40 +0,0 @@ -name: Docker Build and Push - Prod - -on: - workflow_dispatch: - push: - branches: ["prod"] - -permissions: - contents: read - packages: write - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - - name: Create tag name - run: echo "tag=prod-$(date +'%Y-%m-%dT%H-%M-%S')_$GITHUB_SHA" >> $GITHUB_ENV - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Log in to GitHub Container Registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Build and push Docker image - uses: docker/build-push-action@v6 - with: - context: . - platforms: linux/arm64,linux/amd64 - push: true - tags: ghcr.io/nudgebee/nova:${{ env.tag }} - build-args: | - BUILDKIT_INLINE_CACHE=1 diff --git a/.github/workflows/build-image-dev.yaml b/.github/workflows/build-image.yaml similarity index 63% rename from .github/workflows/build-image-dev.yaml rename to .github/workflows/build-image.yaml index d91a99c..9ed147f 100644 --- a/.github/workflows/build-image-dev.yaml +++ b/.github/workflows/build-image.yaml @@ -1,9 +1,10 @@ -name: Docker Build and Push - Dev +name: Build and publish image on: workflow_dispatch: push: branches: ["main"] + tags: ["v*"] permissions: contents: read @@ -12,12 +13,17 @@ permissions: jobs: build: runs-on: ubuntu-latest - steps: - uses: actions/checkout@v4 - - name: Create tag name - run: echo "tag=dev-$(date +'%Y-%m-%dT%H-%M-%S')_$GITHUB_SHA" >> $GITHUB_ENV + - name: Resolve image tag + id: tag + run: | + if [[ "${{ github.ref_type }}" == "tag" ]]; then + echo "value=${GITHUB_REF_NAME}" >> "$GITHUB_OUTPUT" + else + echo "value=$(date +'%Y-%m-%dT%H-%M-%S')_${GITHUB_SHA}" >> "$GITHUB_OUTPUT" + fi - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 @@ -35,6 +41,6 @@ jobs: context: . platforms: linux/arm64,linux/amd64 push: true - tags: ghcr.io/nudgebee/nova:${{ env.tag }} + tags: ghcr.io/nudgebee/nova:${{ steps.tag.outputs.value }} build-args: | BUILDKIT_INLINE_CACHE=1