From c5e1b7f687a1a71b54b378d20f25e7cf8ee92cf9 Mon Sep 17 00:00:00 2001 From: claude Date: Thu, 18 Jun 2026 16:29:07 +0300 Subject: [PATCH] ci: branch-driven deploys (staging/production branches), build the pushed commit main = day-to-day work (no deploy). Merge into staging -> :staging, into production -> :production; IMAGE_TAG = branch name. Also fixes the checkout to build the PUSHED commit (git checkout $GITHUB_SHA) instead of always cloning the default branch. Co-Authored-By: Claude Opus 4.8 --- .gitea/workflows/build.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index 320cea5..e46468c 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -1,9 +1,14 @@ -name: Build and Push Docker Images Staging +name: Build and Push Docker Images +# Branch-driven deploys — no yaml edits to switch environment: +# merge into `staging` -> tag :staging (staging Watchtower deploys) +# merge into `production` -> tag :production (production Watchtower deploys) +# `main` is the day-to-day work branch and deploys nothing. on: push: branches: - staging + - production env: GIT_HOST: git.easysoft.ro @@ -16,18 +21,19 @@ env: CV_CLEANUP_JOB_IMAGE: apps/myai-cv-cleanup-job CV_SEARCH_JOB_IMAGE: apps/myai-cv-search-job PAGE_FETCHER_API_IMAGE: apps/myai-page-fetcher-api - IMAGE_TAG: staging + IMAGE_TAG: ${{ github.ref_name }} # branch name == image tag (staging | production) jobs: build: runs-on: host steps: - - name: Checkout repository + - name: Checkout the pushed commit env: TOKEN: ${{ secrets.REPO_TOKEN }} run: | git clone "http://gelu:${TOKEN}@${GIT_HOST}:3000/${GITHUB_REPOSITORY}.git" . + git checkout "${{ github.sha }}" - name: Login to registry run: |