mirror of
https://github.com/tiennm99/coolify.git
synced 2026-08-18 14:23:15 +00:00
ci(build): use short SHA tags for image manifests
Expose the short SHA between workflow jobs and verify image tag propagation.
This commit is contained in:
@@ -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 \
|
||||
|
||||
@@ -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 }}')
|
||||
|
||||
Reference in New Issue
Block a user