Skip to content

Strip arti-v from Docker tag #16

Strip arti-v from Docker tag

Strip arti-v from Docker tag #16

Workflow file for this run

name: Docker
on:
workflow_dispatch:
push:
branches:
- master
tags:
- "*"
pull_request:
branches:
- master
permissions: {}
jobs:
build:
runs-on: ${{ matrix.runs-on }}
strategy:
matrix:
arch: [amd64, arm64]
include:
- arch: amd64
runs-on: ubuntu-latest
- arch: arm64
runs-on: ubuntu-24.04-arm
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: docker/setup-buildx-action@v3
with:
cache-binary: false
- name: Build
uses: docker/build-push-action@v6
with:
platforms: linux/${{ matrix.arch }}
push: false
build-args: |
${{ startsWith(github.ref, 'refs/tags/') && format('VERSION={0}', github.ref_name) || '' }}
cache-from: |
type=gha,scope=docker-build-${{ matrix.arch }}
cache-to: |
type=gha,mode=max,scope=docker-build-${{ matrix.arch }}
context: .
package:
needs: [build]
runs-on: ubuntu-latest
permissions:
packages: write
steps:
- run: lscpu
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ github.token }}
- uses: docker/setup-buildx-action@v3
with:
cache-binary: false
- uses: docker/metadata-action@v5
id: meta
with:
images: ghcr.io/${{ github.repository_owner }}/arti
flavor: |
latest=auto
prefix=
suffix=
tags: |
# For non-tag events (master branch)
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'master') }}
type=ref,event=branch
type=ref,event=pr
# For tag events, generate semantic versions
type=match,pattern=arti-v?(.*),group=1
type=semver,pattern={{version}},value=${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || '' }}
type=semver,pattern={{major}}.{{minor}},value=${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || '' }}
type=semver,pattern={{major}},value=${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || '' }}
- name: Package and Push
uses: docker/build-push-action@v6
with:
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
${{ startsWith(github.ref, 'refs/tags/') && format('VERSION={0}', github.ref_name) || '' }}
push: true
cache-from: |
type=gha,scope=docker-package
type=gha,scope=docker-build-amd64
type=gha,scope=docker-build-arm64
cache-to: |
type=gha,mode=max,scope=docker-package
context: .