Compare commits
2 commits
e0c78d68fe
...
c56c39f2c5
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c56c39f2c5 | ||
|
|
025ca2ce48 |
1 changed files with 15 additions and 7 deletions
|
|
@ -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 (ว่าง = latest)"
|
||||
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"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue