Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

ci(build): use short SHA tags for image manifests

Andras Bacsai7bcdc230865f
diff --git a/.github/workflows/coolify-sha-build.yml b/.github/workflows/coolify-sha-build.yml
index 7ae7d7e685..8a1967f743 100644
--- a/.github/workflows/coolify-sha-build.yml
+++ b/.github/workflows/coolify-sha-build.yml
@@ -15,6 +15,8 @@ env:
jobs:
build-push:
+ outputs:
+ short_sha: ${{ steps.version.outputs.short_sha }}
strategy:
matrix:
include:
@@ -35,6 +37,7 @@ jobs:
run: |
BASE_VERSION=$(docker run --rm -v "$(pwd):/app" -w /app php:8.2-alpine3.16 php bootstrap/getVersion.php)
echo "version=${BASE_VERSION}-dev.${GITHUB_SHA::9}" >> "$GITHUB_OUTPUT"
+ echo "short_sha=${GITHUB_SHA::7}" >> "$GITHUB_OUTPUT"
- name: Login to ${{ env.GITHUB_REGISTRY }}
uses: docker/login-action@v3
@@ -60,8 +63,8 @@ jobs:
build-args: |
COOLIFY_VERSION=${{ steps.version.outputs.version }}
tags: |
- ${{ env.DOCKER_REGISTRY }}/${{ env.IMAGE_NAME }}:sha-${{ github.sha }}-${{ matrix.arch }}
- ${{ env.GITHUB_REGISTRY }}/${{ env.IMAGE_NAME }}:sha-${{ github.sha }}-${{ matrix.arch }}
+ ${{ env.DOCKER_REGISTRY }}/${{ env.IMAGE_NAME }}:sha-${{ steps.version.outputs.short_sha }}-${{ matrix.arch }}
+ ${{ env.GITHUB_REGISTRY }}/${{ env.IMAGE_NAME }}:sha-${{ steps.version.outputs.short_sha }}-${{ matrix.arch }}
merge-manifest:
runs-on: ubuntu-24.04
@@ -86,7 +89,7 @@ jobs:
- name: Create & publish manifest on ${{ env.GITHUB_REGISTRY }}
env:
REGISTRY: ${{ env.GITHUB_REGISTRY }}
- SHA: ${{ github.sha }}
+ SHA: ${{ needs.build-push.outputs.short_sha }}
run: |
IMAGE="${REGISTRY}/${IMAGE_NAME}"
docker buildx imagetools create \
@@ -97,7 +100,7 @@ jobs:
- name: Create & publish manifest on ${{ env.DOCKER_REGISTRY }}
env:
REGISTRY: ${{ env.DOCKER_REGISTRY }}
- SHA: ${{ github.sha }}
+ SHA: ${{ needs.build-push.outputs.short_sha }}
run: |
IMAGE="${REGISTRY}/${IMAGE_NAME}"
docker buildx imagetools create \
diff --git a/tests/Unit/ProductionImageWorkflowTest.php b/tests/Unit/ProductionImageWorkflowTest.php
index 765a081427..2a360eb9a9 100644
--- a/tests/Unit/ProductionImageWorkflowTest.php
+++ b/tests/Unit/ProductionImageWorkflowTest.php
@@ -9,8 +9,10 @@ it('publishes v4 branch builds under the commit sha with a traceable internal ve
->toContain('name: Build Coolify (SHA)')
->toContain('branches: ["main"]')
->not->toContain('v4.x')
- ->toContain('sha-${{ github.sha }}-${{ matrix.arch }}')
- ->toContain('sha-${{ github.sha }}')
+ ->toContain('short_sha=${GITHUB_SHA::7}')
+ ->toContain('sha-${{ steps.version.outputs.short_sha }}-${{ matrix.arch }}')
+ ->toContain('SHA: ${{ needs.build-push.outputs.short_sha }}')
+ ->not->toContain('sha-${{ github.sha }}')
->toContain('php bootstrap/getVersion.php')
->toContain('version=${BASE_VERSION}-dev.${GITHUB_SHA::9}')
->toContain('COOLIFY_VERSION=${{ steps.version.outputs.version }}')