ci: replace metadata-action with reusable auto-tag action
This commit is contained in:
parent
3fb57b094c
commit
33958d6da8
37
.github/actions/auto-tag/action.yml
vendored
Normal file
37
.github/actions/auto-tag/action.yml
vendored
Normal file
@ -0,0 +1,37 @@
|
||||
name: "Cloud-Neutral Auto Tag"
|
||||
description: "Generate Docker tags for main, release, PR and dev branches"
|
||||
inputs:
|
||||
image:
|
||||
description: "Base image name (e.g. ghcr.io/.../image)"
|
||||
required: true
|
||||
|
||||
outputs:
|
||||
tags:
|
||||
description: "Generated Docker tags"
|
||||
value: ${{ steps.meta.outputs.tags }}
|
||||
labels:
|
||||
description: "Generated Docker labels"
|
||||
value: ${{ steps.meta.outputs.labels }}
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Generate metadata (auto tags)
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: ${{ inputs.image }}
|
||||
|
||||
tags: |
|
||||
# main → latest
|
||||
type=raw,enable=${{ github.ref == 'refs/heads/main' }},value=latest
|
||||
|
||||
# release tag(v1.2.3)
|
||||
type=ref,event=tag
|
||||
type=semver,pattern={{version}}
|
||||
|
||||
# PR → pr-123
|
||||
type=raw,enable=${{ startsWith(github.ref, 'refs/pull/') }},value=pr-${{ github.event.pull_request.number }}
|
||||
|
||||
# dev/feature branches → branch name
|
||||
type=ref,event=branch
|
||||
17
.github/workflows/build-base-images.yml
vendored
17
.github/workflows/build-base-images.yml
vendored
@ -47,13 +47,20 @@ jobs:
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- uses: docker/metadata-action@v5
|
||||
#- uses: docker/metadata-action@v5
|
||||
# id: meta
|
||||
# with:
|
||||
# images: ${{ env.REGISTRY }}/${{ env.ORG }}/${{ matrix.image.name }}
|
||||
# tags: |
|
||||
# type=sha
|
||||
# type=raw,value=latest
|
||||
|
||||
- name: Generate Auto Tags
|
||||
id: meta
|
||||
uses: ./.github/actions/auto-tag
|
||||
with:
|
||||
images: ${{ env.REGISTRY }}/${{ env.ORG }}/${{ matrix.image.name }}
|
||||
tags: |
|
||||
type=sha
|
||||
type=raw,value=latest
|
||||
image: ${{ env.REGISTRY }}/${{ env.ORG }}/${{ matrix.image.name }}
|
||||
|
||||
|
||||
- uses: docker/setup-qemu-action@v3
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user