Compare commits

..

No commits in common. "c56c39f2c54b0afa90a2b57fc2f7a1c33ece64e6" and "e0c78d68fe5e497e482c6d7670cd45e6a22390c4" have entirely different histories.

View file

@ -7,9 +7,8 @@ on:
workflow_dispatch: workflow_dispatch:
inputs: inputs:
version: version:
description: "เวอร์ชันที่จะ deploy เช่น 1.2.3 (ว่าง = latest)" 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: false required: true
type: string
env: env:
# Container Registry # Container Registry
@ -103,20 +102,13 @@ jobs:
outputs: outputs:
image_tag: ${{ steps.image-tag.outputs.tag }} image_tag: ${{ steps.image-tag.outputs.tag }}
steps: steps:
- name: Resolve image tag (deploy1.2.3 / v1.2.3 → v1.2.3, ว่าง → latest) - name: Resolve image tag (deploy1.2.3 / v1.2.3 → v1.2.3)
id: image-tag id: image-tag
run: | run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then RAW="${{ github.event_name == 'workflow_dispatch' && github.event.inputs.version || github.ref_name }}"
RAW="${{ github.event.inputs.version }}" TAG="${RAW#deploy}"
else TAG="${TAG#v}"
RAW="${{ github.ref_name }}" TAG="v$TAG"
fi
TAG="latest"
if [ -n "$RAW" ]; then
TAG="${RAW#deploy}"
TAG="${TAG#v}"
TAG="v$TAG"
fi
echo "tag=$TAG" >> $GITHUB_OUTPUT echo "tag=$TAG" >> $GITHUB_OUTPUT
echo "Reuse image จาก build.yml: ${{ env.REGISTRY_URL }}/${{ env.WEB_IMAGE_NAME }}:$TAG" echo "Reuse image จาก build.yml: ${{ env.REGISTRY_URL }}/${{ env.WEB_IMAGE_NAME }}:$TAG"