Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: tag docker with develop merge #768

Merged
merged 8 commits into from
Jul 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/docker-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ on:
- 'apps/nextjs-app/**'
- 'packages/core/**'
- 'packages/sdk/**'
- '.github/**'
- 'scripts/**'

jobs:
build-push:
Expand Down Expand Up @@ -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
Expand Down
15 changes: 11 additions & 4 deletions scripts/build-image.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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}`;
Expand All @@ -44,7 +48,7 @@ const getSemver = async () => {
break;
}
}

console.log('semver: ', semver);
return semver;
};

Expand Down Expand Up @@ -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);
Expand All @@ -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) {
Expand Down