Skip to content

[containers] fix ghcr tags #5

[containers] fix ghcr tags

[containers] fix ghcr tags #5

name: Build and Push dane-verify
on:
workflow_dispatch:
push:
branches:
- main
paths:
- "dane-verify/**"
- ".github/workflows/build-dane-verify.yml"
create:
tags:
- "dane-verify/v*.*.*"
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Extract tag name
id: tag_name
run: |
if [[ "${{ github.ref_type }}" == "tag" ]]; then
TAG="${{ github.ref_name }}"
VERSION="${TAG#dane-verify/v}"
echo "version=$VERSION" >> $GITHUB_OUTPUT
fi
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository_owner }}/containers-dane-verify
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=semver,pattern={{version}},value=${{ steps.tag_name.outputs.version }},enable=${{ github.ref_type == 'tag' }}
type=semver,pattern={{major}}.{{minor}},value=${{ steps.tag_name.outputs.version }},enable=${{ github.ref_type == 'tag' }}
type=semver,pattern={{major}},value=${{ steps.tag_name.outputs.version }},enable=${{ github.ref_type == 'tag' }}
- name: Login to GitHub Container Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: ./dane-verify
file: ./dane-verify/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}