diff --git a/.github/workflows/docker-push.yml b/.github/workflows/docker-push.yml index f9fe7ad0f..15584a9f4 100644 --- a/.github/workflows/docker-push.yml +++ b/.github/workflows/docker-push.yml @@ -11,6 +11,8 @@ on: - 'apps/nextjs-app/**' - 'packages/core/**' - 'packages/sdk/**' + - '.github/**' + - 'scripts/**' jobs: build-push: @@ -66,10 +68,8 @@ jobs: ghcr.io/teableio/${{ matrix.image }} docker.io/teableio/${{ matrix.image }} tags: | - type=semver,pattern={{version}} - type=semver,pattern={{major}}.{{minor}} - # set latest tag for default branch - type=raw,value=latest,enable={{is_default_branch}} + type=raw,value=latest + - name: ⚙️ Set up QEMU uses: docker/setup-qemu-action@v3 - name: ⚙️ Set up Docker Buildx diff --git a/scripts/build-image.mjs b/scripts/build-image.mjs index 28c6afe2a..7f9804446 100755 --- a/scripts/build-image.mjs +++ b/scripts/build-image.mjs @@ -35,6 +35,10 @@ const getSemver = async () => { const runNumber = env.GITHUB_RUN_NUMBER; const sha = env.GITHUB_SHA.substring(0, 7); + console.log('refType: ', refType); + console.log('runNumber: ', runNumber); + console.log('sha: ', sha); + switch (refType) { case 'branch': semver = `${version}-alpha+build.${runNumber}.sha-${sha}`; @@ -44,7 +48,7 @@ const getSemver = async () => { break; } } - + console.log('semver: ', semver); return semver; }; @@ -92,7 +96,8 @@ const push = toBoolean(pushArg); const command = ['docker', 'buildx', 'build']; // BUILD_VERSION - this is a default behavior -command.push('--build-arg', `BUILD_VERSION=${await getSemver()}`); +const semver = await getSemver(); +command.push('--build-arg', `BUILD_VERSION=${semver}`); await asyncForEach(buildArgs, async (buildArg) => { command.push('--build-arg', buildArg); @@ -109,8 +114,10 @@ if (file) { if (platforms.length > 0) { command.push('--platform', platforms.join(',')); } -await asyncForEach(tags, async (tag) => { - command.push('--tag', `${tag}${tagSuffix ?? ''}`); +await asyncForEach(tags, async (fullName) => { + const [image, tag] = fullName.split(':'); + command.push('--tag', `${image}:${tag}${tagSuffix ?? ''}`); + command.push('--tag', `${image}:${semver}`); }); if (push) {