diff --git a/.releaserc.json b/.releaserc.json index d19e5f541f0797fb2cee63977c004cd33f6f2837..81f2fd02f149e1720df002760c4b01ac952caebb 100644 --- a/.releaserc.json +++ b/.releaserc.json @@ -19,8 +19,8 @@ [ "@semantic-release/exec", { - "prepareCmd": "pnpm release:prepare --version=${nextRelease.version} --sha=${nextRelease.gitHead} --tries=3 --platform=linux/amd64,linux/arm64 --exit-on-error=true", - "publishCmd": "pnpm release:publish --version=${nextRelease.version} --sha=${nextRelease.gitHead} --platform=linux/amd64,linux/arm64 --exit-on-error=true" + "prepareCmd": "pnpm release:prepare --version=${nextRelease.version} --channel='${branch.channel ?? ''}' --sha=${nextRelease.gitHead} --tries=3 --platform=linux/amd64,linux/arm64 --exit-on-error=true", + "publishCmd": "pnpm release:publish --version=${nextRelease.version} --channel='${branch.channel ?? ''}' --sha=${nextRelease.gitHead} --platform=linux/amd64,linux/arm64 --exit-on-error=true" } ] ], diff --git a/tools/docker/bake.hcl b/tools/docker/bake.hcl index b57ec7f20e015dc1d3f381c8ca00382c310e30d6..d961ce1a94dfb0f8b930bfdb29773cd8b26539a8 100644 --- a/tools/docker/bake.hcl +++ b/tools/docker/bake.hcl @@ -13,6 +13,9 @@ variable "RENOVATE_MAJOR_VERSION" { variable "RENOVATE_MAJOR_MINOR_VERSION" { default = "" } +variable "CHANNEL" { + default = "" +} variable "APT_HTTP_PROXY" { default = "" @@ -62,8 +65,12 @@ target "slim" { # "type=registry,ref=ghcr.io/${OWNER}/docker-build-cache:${FILE}", # ] tags = [ - "ghcr.io/${OWNER}/${FILE}", - "${FILE}/${FILE}", + notequal("", CHANNEL) + ? "ghcr.io/${OWNER}/${FILE}:${CHANNEL}" + : "ghcr.io/${OWNER}/${FILE}", + notequal("", CHANNEL) + ? "${FILE}/${FILE}:${CHANNEL}" + : "${FILE}/${FILE}", // GitHub versioned tags notequal("", RENOVATE_VERSION) ? "ghcr.io/${OWNER}/${FILE}:${RENOVATE_VERSION}": "", @@ -86,8 +93,8 @@ target "full" { # "type=registry,ref=ghcr.io/${OWNER}/docker-build-cache:${FILE}-full", # ] tags = [ - "ghcr.io/${OWNER}/${FILE}:full", - "${FILE}/${FILE}:full", + notequal("", CHANNEL) ? "ghcr.io/${OWNER}/${FILE}:${CHANNEL}-full" : "ghcr.io/${OWNER}/${FILE}:full", + notequal("", CHANNEL) ? "${FILE}/${FILE}:${CHANNEL}-full" : "${FILE}/${FILE}:full", // GitHub versioned tags notequal("", RENOVATE_VERSION) ? "ghcr.io/${OWNER}/${FILE}:${RENOVATE_VERSION}-full": "", @@ -113,7 +120,9 @@ target "push-slim" { inherits = ["build-slim"] output = ["type=registry"] cache-to = [ - "type=registry,ref=ghcr.io/${OWNER}/docker-build-cache:${FILE},mode=max,image-manifest=true,ignore-error=true", + notequal("", CHANNEL) + ? "type=registry,ref=ghcr.io/${OWNER}/docker-build-cache:${FILE}-${CHANNEL},mode=max,image-manifest=true,ignore-error=true" + : "type=registry,ref=ghcr.io/${OWNER}/docker-build-cache:${FILE},mode=max,image-manifest=true,ignore-error=true", ] } @@ -121,6 +130,8 @@ target "push-full" { inherits = ["build-full"] output = ["type=registry"] cache-to = [ - "type=registry,ref=ghcr.io/${OWNER}/docker-build-cache:${FILE}-full,mode=max,image-manifest=true,ignore-error=true", + notequal("", CHANNEL) + ? "type=registry,ref=ghcr.io/${OWNER}/docker-build-cache:${FILE}-${CHANNEL}-full,mode=max,image-manifest=true,ignore-error=true" + : "type=registry,ref=ghcr.io/${OWNER}/docker-build-cache:${FILE}-full,mode=max,image-manifest=true,ignore-error=true", ] } diff --git a/tools/prepare-release.ts b/tools/prepare-release.ts index 00ffaf60f9559ac15c71b0d53434cecbae38a0bd..18d7e129d01dcb075d3eac9c4e6365e5cf580525 100644 --- a/tools/prepare-release.ts +++ b/tools/prepare-release.ts @@ -15,6 +15,7 @@ const program = new Command('pnpm release:prepare') .description('Build docker images') .option('--platform <type>', 'docker platforms to build') .option('--version <version>', 'version to use as tag', parseVersion) + .option('--channel <channel>', 'channel to use as tag') .option('--sha <type>', 'git sha') .option('--tries <tries>', 'number of tries for docker build', parseInt) .option( diff --git a/tools/publish-release.ts b/tools/publish-release.ts index 590ef44aab1625503bff33c6255902e025547478..c16fcb591d7d13bae1224ace3d98ad5662d692c5 100644 --- a/tools/publish-release.ts +++ b/tools/publish-release.ts @@ -13,6 +13,7 @@ const program = new Command('pnpm release:prepare') .description('Build docker images') .option('--platform <type>', 'docker platforms to build') .option('--version <version>', 'version to use as tag', parseVersion) + .option('--channel <channel>', 'channel to use as tag') .option('--sha <type>', 'git sha') .option('--exit-on-error <boolean>', 'exit on docker error', (s) => s ? s !== 'false' : undefined, diff --git a/tools/utils/docker.ts b/tools/utils/docker.ts index c7869752f340a6b851724010424f68fe55a671e2..fbfa5d5390a24b9959f503d1e090eced1825ad7a 100644 --- a/tools/utils/docker.ts +++ b/tools/utils/docker.ts @@ -27,6 +27,7 @@ export async function bake( delay?: string; exitOnError?: boolean; tries?: number; + channel?: string; }, ): Promise<MetaData | null> { if (opts.version) { @@ -38,6 +39,10 @@ export async function bake( } } + if (opts.channel) { + process.env.CHANNEL = opts.channel; + } + const metadataFile = path.join(await tmp, 'metadata.json'); const args = [ 'buildx',