Skip to content

add v prefix to version #9

add v prefix to version

add v prefix to version #9

name: Container Images
on:
workflow_dispatch:
push:
branches:
- main
create:
tags:
- v*
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build the Docker image
run: |
repo="ghcr.io/docspell/joex"
image_name="${repo}:latest"
docker build --cache-from type=gha --cache-to type=gha,mode=max -t "$image_name" -f Dockerfile.joex .
docker push "$image_name"
full_version="$(docker run --rm --entrypoint cat "$image_name" /opt/docspell-joex/version)"
full_version_name="${repo}:v${full_version}"
docker tag "$image_name" "$full_version_name"
docker push "$full_version_name"
minor_version="$(cut -d'.' -f1 <<< "$full_version").$(cut -d'.' -f2 <<< "$full_version")"
minor_version_name="${repo}:v${minor_version}"
docker tag "$image_name" "$minor_version_name"
docker push "$minor_version_name"