Skip to content

Bump version to 2.3.4 #6

Bump version to 2.3.4

Bump version to 2.3.4 #6

name: Build and Publish Docker Image
on:
push:
tags:
- 'v*.*.*'
branches:
- develop
- main
pull_request:
branches:
- develop
- main
workflow_dispatch:
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
matrix:
include:
- ubuntu-version: "24.04"
root-version: "6.34.00"
suffix: "ubuntu24.04"
is-default: true
- ubuntu-version: "22.04"
root-version: "6.32.02"
suffix: "ubuntu22.04"
is-default: false
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
# For PRs, tag with pr-number and ubuntu version
type=ref,event=pr,suffix=-${{ matrix.suffix }}
# For branch pushes, tag with branch name and ubuntu version
type=ref,event=branch,suffix=-${{ matrix.suffix }}
# For version tags: v2.3.4 -> 2.3.4-ubuntu24.04, etc.
type=semver,pattern={{version}},suffix=-${{ matrix.suffix }}
type=semver,pattern={{major}}.{{minor}},suffix=-${{ matrix.suffix }}
# Ubuntu version tag (always created)
type=raw,value=${{ matrix.suffix }}
# Latest tag only for default Ubuntu version (24.04) on version tags
type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/v') && matrix.is-default == true }}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
build-args: |
UBUNTU_VERSION=${{ matrix.ubuntu-version }}
ROOT_VERSION=${{ matrix.root-version }}
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha,scope=${{ matrix.suffix }}
cache-to: type=gha,mode=max,scope=${{ matrix.suffix }}
cleanup-old-images:
runs-on: ubuntu-latest
needs: build-and-push
if: github.event_name != 'pull_request'
permissions:
packages: write
steps:
- name: Delete old untagged images
uses: actions/delete-package-versions@v5
with:
package-name: 'larcv2'
package-type: 'container'
min-versions-to-keep: 5
delete-only-untagged-versions: 'true'