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:
|
workflow_dispatch:
|
||||||
inputs:
|
inputs:
|
||||||
version:
|
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 ไว้ก่อน)"
|
description: "เวอร์ชันที่จะ deploy เช่น 1.2.3 (ว่าง = latest)"
|
||||||
required: true
|
required: false
|
||||||
|
type: string
|
||||||
|
|
||||||
env:
|
env:
|
||||||
# Container Registry
|
# Container Registry
|
||||||
|
|
@ -102,13 +103,20 @@ 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)
|
- name: Resolve image tag (deploy1.2.3 / v1.2.3 → v1.2.3, ว่าง → latest)
|
||||||
id: image-tag
|
id: image-tag
|
||||||
run: |
|
run: |
|
||||||
RAW="${{ github.event_name == 'workflow_dispatch' && github.event.inputs.version || github.ref_name }}"
|
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="${RAW#deploy}"
|
||||||
TAG="${TAG#v}"
|
TAG="${TAG#v}"
|
||||||
TAG="v$TAG"
|
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"
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue