diff --git a/.github/workflows/build-container.yml b/.github/workflows/build-container.yml index a82a6683..f5ad9cc0 100644 --- a/.github/workflows/build-container.yml +++ b/.github/workflows/build-container.yml @@ -1,11 +1,12 @@ name: Build and Push Docker Image -on: workflow_dispatch +on: + # Allows manual triggering of the workflow + workflow_dispatch: permissions: contents: read packages: write - actions: read jobs: build-and-push: @@ -28,7 +29,7 @@ jobs: - name: Checkout uses: actions/checkout@v4 with: - fetch-depth: 100 # Enough for rev-list, but saves GBs of history + fetch-depth: 0 # 0 indicates all history for all branches and tags - name: Free Disk Space (Ubuntu) run: | @@ -57,7 +58,6 @@ jobs: id: prep run: | echo "BUILD_NUMBER=$(git rev-list --count HEAD)" >> $GITHUB_ENV - echo "LLAMA_COMMIT=$(git rev-parse --short HEAD)" >> $GITHUB_ENV echo "REPO_LOWER=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV # 5.1 Restore the cache from GitHub's storage to a host folder @@ -86,7 +86,6 @@ jobs: REPO_OWNER: ${{ env.REPO_LOWER }} VARIANT: ${{ matrix.variant }} BUILD_NUMBER: ${{ env.BUILD_NUMBER }} - LLAMA_COMMIT: ${{ env.LLAMA_COMMIT }} CUDA_VERSION: ${{ matrix.cuda_version }} GGML_NATIVE: "OFF" # Force OFF for CI portability USE_CCACHE: "true" @@ -103,18 +102,17 @@ jobs: cleanup: runs-on: ubuntu-latest needs: build-and-push - if: success() + permissions: + packages: write steps: - name: Delete untagged images - uses: vlaurin/action-ghcr-prune@v0.6.0 + uses: dataaxiom/ghcr-cleanup-action@v1 with: - # Use a PAT if GITHUB_TOKEN continues to return "Not Found" - token: ${{ secrets.GITHUB_TOKEN }} - # Ensure this matches the package owner (user or org) - organization: ${{ github.repository_owner }} - container: ik-llama-cpp - # Changed from untagged-only to the valid input - untagged: true - # Optional: Keep the most recent untagged if needed, - # otherwise 0 deletes all untagged. - keep-last: 0 + token: ${{ secrets.GITHUB_TOKEN }} + # Use the lower-case owner env you created earlier if possible, + # or just github.repository_owner + owner: ${{ github.repository_owner }} + package: ik-llama-cpp + delete-untagged: true + # This helps avoid the "Package not found" error during high-volume deletion + validate: false \ No newline at end of file diff --git a/docker-bake.hcl b/docker-bake.hcl index 56850366..e983d14b 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -1,7 +1,6 @@ variable "REPO_OWNER" { default = "local" } variable "VARIANT" { default = "cpu" } variable "BUILD_NUMBER" { default = "0" } -variable "LLAMA_COMMIT" { default = "local-dev" } variable "CUDA_VERSION" {} variable "CUDA_DOCKER_ARCH" { default = "86;90" } variable "USE_CCACHE" { default = "true" } @@ -22,7 +21,6 @@ target "settings" { inherits = ["cache_settings"] args = { BUILD_NUMBER = "${BUILD_NUMBER}" - BUILD_COMMIT = "${LLAMA_COMMIT}" CUDA_VERSION = "${CUDA_VERSION}" CUDA_DOCKER_ARCH = "${CUDA_DOCKER_ARCH}" GGML_NATIVE = "${GGML_NATIVE}" @@ -43,7 +41,7 @@ target "full" { inherits = ["settings"] target = "full" tags = [ - "ghcr.io/${REPO_OWNER}/ik-llama-cpp:${VARIANT}-full-${BUILD_NUMBER}-${LLAMA_COMMIT}", + "ghcr.io/${REPO_OWNER}/ik-llama-cpp:${VARIANT}-full-${BUILD_NUMBER}", "ghcr.io/${REPO_OWNER}/ik-llama-cpp:${VARIANT}-full" ] } @@ -52,7 +50,7 @@ target "swap" { inherits = ["settings"] target = "swap" tags = [ - "ghcr.io/${REPO_OWNER}/ik-llama-cpp:${VARIANT}-swap-${BUILD_NUMBER}-${LLAMA_COMMIT}", + "ghcr.io/${REPO_OWNER}/ik-llama-cpp:${VARIANT}-swap-${BUILD_NUMBER}", "ghcr.io/${REPO_OWNER}/ik-llama-cpp:${VARIANT}-swap" ] } \ No newline at end of file