2828 push_to_registry :
2929 name : Push Docker image to Docker Hub
3030
31- runs-on : ubuntu-22.04
31+ runs-on : ${{ matrix.config.runs_on }}
3232 env :
3333 COMMIT_SHA : ${{ github.sha }}
3434 strategy :
@@ -39,12 +39,12 @@ jobs:
3939 # Note: the arm64 images are failing, which prevents the amd64 images from being built
4040 # https://github.com/ggml-org/llama.cpp/issues/11888
4141 # - { tag: "cpu", dockerfile: ".devops/cpu.Dockerfile", platforms: "linux/amd64,linux/arm64", full: true, light: true, server: true, free_disk_space: false }
42- - { tag: "cpu", dockerfile: ".devops/cpu.Dockerfile", platforms: "linux/amd64", full: true, light: true, server: true, free_disk_space: false }
43- - { tag: "cuda", dockerfile: ".devops/cuda.Dockerfile", platforms: "linux/amd64", full: true, light: true, server: true, free_disk_space: false }
44- - { tag: "musa", dockerfile: ".devops/musa.Dockerfile", platforms: "linux/amd64", full: true, light: true, server: true, free_disk_space: true }
45- - { tag: "intel", dockerfile: ".devops/intel.Dockerfile", platforms: "linux/amd64", full: true, light: true, server: true, free_disk_space: true }
46- - { tag: "vulkan", dockerfile: ".devops/vulkan.Dockerfile", platforms: "linux/amd64", full: true, light: true, server: true, free_disk_space: false }
47- - { tag: "s390x", dockerfile: ".devops/s390x.Dockerfile", platforms: "linux/s390x", full: true, light: true, server: true, free_disk_space: false }
42+ - { tag: "cpu", dockerfile: ".devops/cpu.Dockerfile", platforms: "linux/amd64", full: true, light: true, server: true, free_disk_space: false, runs_on: "ubuntu-22.04" }
43+ - { tag: "cuda", dockerfile: ".devops/cuda.Dockerfile", platforms: "linux/amd64", full: true, light: true, server: true, free_disk_space: false, runs_on: "ubuntu-22.04" }
44+ - { tag: "musa", dockerfile: ".devops/musa.Dockerfile", platforms: "linux/amd64", full: true, light: true, server: true, free_disk_space: true, runs_on: "ubuntu-22.04" }
45+ - { tag: "intel", dockerfile: ".devops/intel.Dockerfile", platforms: "linux/amd64", full: true, light: true, server: true, free_disk_space: true, runs_on: "ubuntu-22.04" }
46+ - { tag: "vulkan", dockerfile: ".devops/vulkan.Dockerfile", platforms: "linux/amd64", full: true, light: true, server: true, free_disk_space: false, runs_on: "ubuntu-22.04" }
47+ - { tag: "s390x", dockerfile: ".devops/s390x.Dockerfile", platforms: "linux/s390x", full: true, light: true, server: true, free_disk_space: false, runs_on: "ubuntu-22.04-s390x" }
4848 # Note: the rocm images are failing due to a compiler error and are disabled until this is fixed to allow the workflow to complete
4949 # - {tag: "rocm", dockerfile: ".devops/rocm.Dockerfile", platforms: "linux/amd64,linux/arm64", full: true, light: true, server: true, free_disk_space: true }
5050 steps :
5454 fetch-depth : 0 # preserve git history, so we can determine the build number
5555
5656 - name : Set up QEMU
57+ if : ${{ matrix.config.tag != 's390x' }}
5758 uses : docker/setup-qemu-action@v3
5859 with :
5960 image : tonistiigi/binfmt:qemu-v7.0.0-28
@@ -68,40 +69,36 @@ jobs:
6869 username : ${{ github.repository_owner }}
6970 password : ${{ secrets.GITHUB_TOKEN }}
7071
71- - name : Determine tag name
72+ - name : Determine source tag name
73+ id : srctag
74+ uses : ./.github/actions/get-tag-name
75+ env :
76+ BRANCH_NAME : ${{ github.head_ref || github.ref_name }}
77+
78+ - name : Determine image tag name
7279 id : tag
7380 shell : bash
7481 run : |
75- BUILD_NUMBER="$(git rev-list --count HEAD)"
76- SHORT_HASH="$(git rev-parse --short=7 HEAD)"
7782 REPO_OWNER="${GITHUB_REPOSITORY_OWNER@L}" # to lower case
7883 REPO_NAME="${{ github.event.repository.name }}"
7984
80- # determine tag name postfix (build number, commit hash)
81- if [[ "${{ env.GITHUB_BRANCH_NAME }}" == "master" ]]; then
82- TAG_POSTFIX="-b${BUILD_NUMBER}"
83- else
84- SAFE_NAME=$(echo "${{ env.GITHUB_BRANCH_NAME }}" | tr '/' '-')
85- TAG_POSTFIX="-${SAFE_NAME}-${SHORT_HASH}"
86- fi
8785 # list all tags possible
8886 if [[ "${{ matrix.config.tag }}" == "cpu" ]]; then
8987 TYPE=""
9088 else
9189 TYPE="-${{ matrix.config.tag }}"
9290 fi
9391 PREFIX="ghcr.io/${REPO_OWNER}/${REPO_NAME}:"
94- FULLTAGS="${PREFIX}full${TYPE},${PREFIX}full${TYPE}${TAG_POSTFIX }"
95- LIGHTTAGS="${PREFIX}light${TYPE},${PREFIX}light${TYPE}${TAG_POSTFIX }"
96- SERVERTAGS="${PREFIX}server${TYPE},${PREFIX}server${TYPE}${TAG_POSTFIX }"
92+ FULLTAGS="${PREFIX}full${TYPE},${PREFIX}full${TYPE}-${{ steps.srctag.outputs.name } }"
93+ LIGHTTAGS="${PREFIX}light${TYPE},${PREFIX}light${TYPE}-${{ steps.srctag.outputs.name } }"
94+ SERVERTAGS="${PREFIX}server${TYPE},${PREFIX}server${TYPE}-${{ steps.srctag.outputs.name } }"
9795 echo "full_output_tags=$FULLTAGS" >> $GITHUB_OUTPUT
9896 echo "light_output_tags=$LIGHTTAGS" >> $GITHUB_OUTPUT
9997 echo "server_output_tags=$SERVERTAGS" >> $GITHUB_OUTPUT
10098 echo "full_output_tags=$FULLTAGS" # print out for debugging
10199 echo "light_output_tags=$LIGHTTAGS" # print out for debugging
102100 echo "server_output_tags=$SERVERTAGS" # print out for debugging
103101 env :
104- GITHUB_BRANCH_NAME : ${{ github.head_ref || github.ref_name }}
105102 GITHUB_REPOSITORY_OWNER : ' ${{ github.repository_owner }}'
106103
107104 - name : Free Disk Space (Ubuntu)
@@ -177,3 +174,29 @@ jobs:
177174 # return to this if the experimental github cache is having issues
178175 # cache-to: type=local,dest=/tmp/.buildx-cache
179176 # cache-from: type=local,src=/tmp/.buildx-cache
177+
178+ create_tag :
179+ name : Create and push git tag
180+ runs-on : ubuntu-22.04
181+ permissions :
182+ contents : write
183+
184+ steps :
185+ - name : Clone
186+ id : checkout
187+ uses : actions/checkout@v4
188+ with :
189+ fetch-depth : 0
190+
191+ - name : Determine source tag name
192+ id : srctag
193+ uses : ./.github/actions/get-tag-name
194+ env :
195+ BRANCH_NAME : ${{ github.head_ref || github.ref_name }}
196+
197+ - name : Create and push git tag
198+ env :
199+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
200+ run : |
201+ git tag ${{ steps.srctag.outputs.name }} || exit 0
202+ git push origin ${{ steps.srctag.outputs.name }} || exit 0
0 commit comments