Use git tag for Docker image versioning instead of semver

• Add step to get latest git tag
• Replace semver with raw tag value
• Maintain latest tag for default branch
• Fix tag resolution in CI pipeline
This commit is contained in:
yangdx 2025-09-05 01:00:24 +08:00
parent be3f0ebbe5
commit e16c302f5f

View file

@ -26,13 +26,19 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Get latest tag
id: get_tag
run: |
TAG=$(git describe --tags --abbrev=0)
echo "tag=$TAG" >> $GITHUB_OUTPUT
- name: Extract metadata for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=semver,pattern={{version}}
type=raw,value=${{ steps.get_tag.outputs.tag }}
type=raw,value=latest,enable={{is_default_branch}}
- name: Build and push Docker image