From 025ca2ce48b694314f76ed06cbcedc55b05e999e Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 17 Sep 2026 17:15:24 +0700 Subject: [PATCH] =?UTF-8?q?CD:=20uat.yml=20=E0=B9=81=E0=B8=81=E0=B9=89=20R?= =?UTF-8?q?un=20workflow=20=E0=B8=88=E0=B8=B2=E0=B8=81=20UI=20=E0=B9=84?= =?UTF-8?q?=E0=B8=A1=E0=B9=88=E0=B9=84=E0=B8=94=E0=B9=89=E0=B8=9A=E0=B8=99?= =?UTF-8?q?=20Forgejo=2011=20=E2=80=94=20=E0=B8=AD=E0=B8=B2=E0=B8=81?= =?UTF-8?q?=E0=B8=B2=E0=B8=A3:=20=E0=B8=81=E0=B8=94=20Run=20workflow=20?= =?UTF-8?q?=E0=B9=81=E0=B8=A5=E0=B9=89=E0=B8=A7=E0=B9=84=E0=B8=A1=E0=B9=88?= =?UTF-8?q?=E0=B8=A1=E0=B8=B5=E0=B8=8A=E0=B9=88=E0=B8=AD=E0=B8=87=E0=B8=81?= =?UTF-8?q?=E0=B8=A3=E0=B8=AD=E0=B8=81=20version=20=E0=B9=81=E0=B8=95?= =?UTF-8?q?=E0=B9=88=20backend=20=E0=B8=82=E0=B8=A7=E0=B8=B2=E0=B8=87?= =?UTF-8?q?=E0=B8=94=E0=B9=89=E0=B8=A7=E0=B8=A2=20"Require=20value=20for?= =?UTF-8?q?=20input"=20(Forgejo=2011=20base=20Gitea=201.22=20=3D=20UI=20?= =?UTF-8?q?=E0=B8=A2=E0=B8=B1=E0=B8=87=E0=B9=84=E0=B8=A1=E0=B9=88=20render?= =?UTF-8?q?=20workflow=5Fdispatch=20input=20fields,=20Gitea=20=E0=B9=80?= =?UTF-8?q?=E0=B8=9E=E0=B8=B4=E0=B9=88=E0=B8=A1=E0=B9=83=E0=B8=99=201.23-1?= =?UTF-8?q?.24)=20=E2=80=94=20=E0=B9=81=E0=B8=81=E0=B9=89=202=20=E0=B8=8A?= =?UTF-8?q?=E0=B8=B1=E0=B9=89=E0=B8=99:=20(1)=20input=20=E0=B9=80=E0=B8=95?= =?UTF-8?q?=E0=B8=B4=E0=B8=A1=20type:=20string=20=E0=B8=95=E0=B8=B2?= =?UTF-8?q?=E0=B8=A1=20GitHub=20spec=20=E0=B9=80=E0=B8=9C=E0=B8=B7?= =?UTF-8?q?=E0=B9=88=E0=B8=AD=20renderer=20=E0=B8=95=E0=B9=89=E0=B8=AD?= =?UTF-8?q?=E0=B8=87=E0=B9=80=E0=B8=88=E0=B8=AD=20type=20=E0=B8=96?= =?UTF-8?q?=E0=B8=B6=E0=B8=87=E0=B8=A7=E0=B8=B2=E0=B8=94=E0=B8=8A=E0=B9=88?= =?UTF-8?q?=E0=B8=AD=E0=B8=87=20(2)=20required:=20false=20+=20step=20Resol?= =?UTF-8?q?ve=20=E0=B8=A3=E0=B8=AD=E0=B8=87=E0=B8=A3=E0=B8=B1=E0=B8=9A?= =?UTF-8?q?=E0=B8=84=E0=B9=88=E0=B8=B2=E0=B8=A7=E0=B9=88=E0=B8=B2=E0=B8=87?= =?UTF-8?q?:=20dispatch=20=E0=B9=82=E0=B8=94=E0=B8=A2=E0=B9=84=E0=B8=A1?= =?UTF-8?q?=E0=B9=88=E0=B9=83=E0=B8=AA=E0=B9=88=20version=20=3D=20deploy?= =?UTF-8?q?=20:latest=20(image=20=E0=B8=A5=E0=B9=88=E0=B8=B2=E0=B8=AA?= =?UTF-8?q?=E0=B8=B8=E0=B8=94=E0=B8=97=E0=B8=B5=E0=B9=88=20build.yml=20pus?= =?UTF-8?q?h=20=E0=B8=95=E0=B8=AD=E0=B8=99=20tag=20v*=20=E2=80=94=20?= =?UTF-8?q?=E0=B8=84=E0=B8=B7=E0=B8=AD=E0=B9=80=E0=B8=A7=E0=B8=AD=E0=B8=A3?= =?UTF-8?q?=E0=B9=8C=E0=B8=8A=E0=B8=B1=E0=B8=99=E0=B8=97=E0=B8=B5=E0=B9=88?= =?UTF-8?q?=E0=B9=80=E0=B8=9E=E0=B8=B4=E0=B9=88=E0=B8=87=20deploy=20Test?= =?UTF-8?q?=20=E0=B9=84=E0=B8=9B)=20=E0=B9=83=E0=B8=AA=E0=B9=88=E0=B8=84?= =?UTF-8?q?=E0=B9=88=E0=B8=B2=E0=B8=A1=E0=B8=B2=20(1.2.3/v1.2.3/deploy1.2.?= =?UTF-8?q?3)=20=E0=B8=81=E0=B9=87=20map=20=E0=B9=80=E0=B8=9B=E0=B9=87?= =?UTF-8?q?=E0=B8=99=20v1.2.3=20=E0=B9=80=E0=B8=AB=E0=B8=A1=E0=B8=B7?= =?UTF-8?q?=E0=B8=AD=E0=B8=99=E0=B9=80=E0=B8=94=E0=B8=B4=E0=B8=A1=20+=20?= =?UTF-8?q?=E0=B9=80=E0=B8=82=E0=B8=B5=E0=B8=A2=E0=B8=99=20if/else=20?= =?UTF-8?q?=E0=B9=81=E0=B8=A2=E0=B8=81=20event=20=E0=B9=81=E0=B8=97?= =?UTF-8?q?=E0=B8=99=20&&/||=20=E0=B9=80=E0=B8=9E=E0=B8=A3=E0=B8=B2?= =?UTF-8?q?=E0=B8=B0=20input=20=E0=B8=A7=E0=B9=88=E0=B8=B2=E0=B8=87?= =?UTF-8?q?=E0=B8=88=E0=B8=B0=20short-circuit=20=E0=B8=95=E0=B8=81?= =?UTF-8?q?=E0=B9=84=E0=B8=9B=E0=B9=83=E0=B8=8A=E0=B9=89=20ref=5Fname=20(?= =?UTF-8?q?=E0=B8=8A=E0=B8=B7=E0=B9=88=E0=B8=AD=20branch)=20=E0=B9=80?= =?UTF-8?q?=E0=B8=81=E0=B8=B4=E0=B8=94=E0=B9=80=E0=B8=9B=E0=B9=87=E0=B8=99?= =?UTF-8?q?=20image=20vdev=20=E2=80=94=20verify:=20js-yaml=20=E0=B8=9C?= =?UTF-8?q?=E0=B9=88=E0=B8=B2=E0=B8=99=20+=20=E0=B8=97=E0=B8=94=E0=B8=AA?= =?UTF-8?q?=E0=B8=AD=E0=B8=9A=20resolve=20=E0=B8=84=E0=B8=A3=E0=B8=9A=20(d?= =?UTF-8?q?eploy1.2.3/v1.2.3/1.2.3=20=E2=86=92=20v1.2.3,=20=E0=B8=A7?= =?UTF-8?q?=E0=B9=88=E0=B8=B2=E0=B8=87=20=E2=86=92=20latest)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Code --- .forgejo/workflows/uat.yml | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/.forgejo/workflows/uat.yml b/.forgejo/workflows/uat.yml index e38514c..a648843 100644 --- a/.forgejo/workflows/uat.yml +++ b/.forgejo/workflows/uat.yml @@ -7,8 +7,9 @@ on: workflow_dispatch: inputs: version: - description: "เวอร์ชันที่จะ deploy เช่น 1.2.3 / v1.2.3 / deploy1.2.3 — จะ map เป็น image v1.2.3 (ต้อง push tag v1.2.3 ให้ build.yml build ไว้ก่อน)" - required: true + description: "เวอร์ชันที่จะ deploy เช่น 1.2.3 / v1.2.3 / deploy1.2.3 — จะ map เป็น image v1.2.3 | เว้นว่าง = latest (image ล่าสุดที่ build.yml push ไว้)" + required: false + type: string env: # Container Registry @@ -102,13 +103,20 @@ jobs: outputs: image_tag: ${{ steps.image-tag.outputs.tag }} steps: - - name: Resolve image tag (deploy1.2.3 / v1.2.3 → v1.2.3) + - name: Resolve image tag (deploy1.2.3 / v1.2.3 → v1.2.3, ว่าง → latest) id: image-tag run: | - RAW="${{ github.event_name == 'workflow_dispatch' && github.event.inputs.version || github.ref_name }}" - TAG="${RAW#deploy}" - TAG="${TAG#v}" - TAG="v$TAG" + if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then + RAW="${{ github.event.inputs.version }}" + else + RAW="${{ github.ref_name }}" + fi + TAG="latest" + if [ -n "$RAW" ]; then + TAG="${RAW#deploy}" + TAG="${TAG#v}" + TAG="v$TAG" + fi echo "tag=$TAG" >> $GITHUB_OUTPUT echo "Reuse image จาก build.yml: ${{ env.REGISTRY_URL }}/${{ env.WEB_IMAGE_NAME }}:$TAG"