Skip to content

Commit 3113c72

Browse files
trevorgowingclaude
andcommitted
Build and publish Docker image to GHCR on release tag push
Triggers when the sync workflow pushes an upstream release tag to this fork, and on merge of conflict-resolution PRs. Also available as a manual dispatch for on-demand rebuilds. Images are tagged with the upstream version (e.g. v0.61.2) and latest, tracking upstream Metabase releases 1:1 with no independent versioning. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent e15e9f6 commit 3113c72

2 files changed

Lines changed: 150 additions & 2 deletions

File tree

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
name: Build and Publish Docker Image
2+
3+
# Triggers:
4+
# 1. Push of an upstream release tag (e.g. v0.61.2) to this fork — done
5+
# automatically by teal-sync-upstream-release.yml on a clean merge
6+
# that includes a new release.
7+
# 2. A sync/upstream-* PR merged to master (conflict-resolution path).
8+
# 3. Manual dispatch — useful for rebuilding any version on demand.
9+
10+
on:
11+
push:
12+
tags:
13+
- 'v[0-9]*'
14+
pull_request:
15+
types: [closed]
16+
workflow_dispatch:
17+
inputs:
18+
version:
19+
description: "Upstream version tag to build (e.g. v0.61.2). Defaults to the current latest upstream release."
20+
required: false
21+
22+
jobs:
23+
# ── Resolve whether this run should produce a build, and which version tag ──
24+
25+
resolve:
26+
name: Resolve version
27+
runs-on: ubuntu-latest
28+
outputs:
29+
should_build: ${{ steps.resolve.outputs.should_build }}
30+
version: ${{ steps.resolve.outputs.version }}
31+
steps:
32+
- name: Determine version and build gate
33+
id: resolve
34+
env:
35+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
36+
run: |
37+
EVENT="${{ github.event_name }}"
38+
39+
if [[ "$EVENT" == "workflow_dispatch" ]]; then
40+
VERSION="${{ inputs.version }}"
41+
if [[ -z "$VERSION" ]]; then
42+
VERSION=$(gh api repos/metabase/metabase/releases/latest --jq '.tag_name')
43+
fi
44+
echo "should_build=true" >> "$GITHUB_OUTPUT"
45+
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
46+
echo "Manual dispatch — building $VERSION"
47+
48+
elif [[ "$EVENT" == "push" ]]; then
49+
# Triggered by a release tag pushed to this fork by the sync workflow
50+
VERSION="${{ github.ref_name }}"
51+
echo "should_build=true" >> "$GITHUB_OUTPUT"
52+
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
53+
echo "Tag push detected — building $VERSION"
54+
55+
elif [[ "$EVENT" == "pull_request" ]]; then
56+
MERGED="${{ github.event.pull_request.merged }}"
57+
BRANCH="${{ github.event.pull_request.head.ref }}"
58+
59+
if [[ "$MERGED" == "true" ]] && [[ "$BRANCH" =~ ^sync/upstream- ]]; then
60+
VERSION=$(gh api repos/metabase/metabase/releases/latest --jq '.tag_name')
61+
echo "should_build=true" >> "$GITHUB_OUTPUT"
62+
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
63+
echo "Upstream-sync PR merged — building $VERSION"
64+
else
65+
echo "should_build=false" >> "$GITHUB_OUTPUT"
66+
echo "PR is not a merged upstream-sync — skipping."
67+
fi
68+
fi
69+
70+
# ── Build the Docker image and push to GHCR ──
71+
72+
build-and-push:
73+
name: Build and push to GHCR
74+
needs: resolve
75+
if: needs.resolve.outputs.should_build == 'true'
76+
runs-on: ubuntu-latest
77+
timeout-minutes: 90
78+
permissions:
79+
contents: read
80+
packages: write
81+
82+
steps:
83+
- name: Checkout
84+
uses: actions/checkout@v6
85+
86+
# Docker image names must be lowercase; github.repository preserves case.
87+
- name: Normalise image name
88+
id: image
89+
run: |
90+
echo "name=ghcr.io/$(echo '${{ github.repository }}' | tr '[:upper:]' '[:lower:]')" \
91+
>> "$GITHUB_OUTPUT"
92+
93+
- name: Set up Docker Buildx
94+
uses: docker/setup-buildx-action@v4
95+
96+
- name: Log in to GHCR
97+
uses: docker/login-action@v4
98+
with:
99+
registry: ghcr.io
100+
username: ${{ github.actor }}
101+
password: ${{ secrets.GITHUB_TOKEN }}
102+
103+
- name: Build and push
104+
uses: docker/build-push-action@v7
105+
with:
106+
context: .
107+
push: true
108+
build-args: |
109+
MB_EDITION=oss
110+
VERSION=${{ needs.resolve.outputs.version }}
111+
tags: |
112+
${{ steps.image.outputs.name }}:${{ needs.resolve.outputs.version }}
113+
${{ steps.image.outputs.name }}:latest
114+
cache-from: type=gha
115+
cache-to: type=gha,mode=max
116+
117+
- name: Summary
118+
run: |
119+
IMAGE="${{ steps.image.outputs.name }}"
120+
VERSION="${{ needs.resolve.outputs.version }}"
121+
{
122+
echo "### Docker image published"
123+
echo ""
124+
echo "| Tag | Image |"
125+
echo "|-----|-------|"
126+
echo "| \`$VERSION\` | \`$IMAGE:$VERSION\` |"
127+
echo "| \`latest\` | \`$IMAGE:latest\` |"
128+
echo ""
129+
echo "\`\`\`bash"
130+
echo "docker pull $IMAGE:$VERSION"
131+
echo "\`\`\`"
132+
} >> "$GITHUB_STEP_SUMMARY"

README-TEAL.md

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ No functional changes are made to the core Metabase product. All upstream featur
1414
|------|-----|----------|
1515
| Primary brand | `#135756` | Buttons, links, interactive elements |
1616
| Nav background | `#012D2C` | Top navigation and admin bar |
17-
| Nav deep | `#001A19` | Inverse/depth depth nav backgrounds |
17+
| Nav deep | `#001A19` | Inverse/depth nav backgrounds |
1818
| Accent gold | `#E2B018` | Warnings and highlights |
1919
| Accent cream | `#FDF0C8` | Warning backgrounds |
2020
| Subtle background | `#E0E6E6` | Light UI backgrounds |
@@ -34,7 +34,7 @@ The default UI font is **Poppins** (already bundled with Metabase upstream). Cha
3434

3535
## Versioning
3636

37-
This fork makes cosmetic changes only and tracks upstream Metabase release-for-release. It uses upstream version tags directly (e.g. `v0.61.2`) — there is no independent versioning scheme.
37+
This fork makes cosmetic changes only and tracks upstream Metabase release-for-release. It uses upstream version tags directly (e.g. `v0.61.2`) — there is no independent versioning scheme. Docker images are published under the same tag, so the image version always corresponds exactly to the underlying Metabase version.
3838

3939
---
4040

@@ -71,3 +71,19 @@ Merges the latest upstream release tag into this fork's `master` daily, keeping
7171
**Requires:** A repository secret named `SYNC_TOKEN` — a fine-grained PAT scoped to this repo with Contents, Workflows, and Pull Requests read/write permissions.
7272

7373
**Conflict resolution:** The three branding files above are the most likely to conflict. In each case, keep the Teal values — the upstream values for those specific keys will always be wrong for this fork.
74+
75+
### Docker Publishing — `teal-docker-publish.yml`
76+
77+
Builds the Metabase OSS image from the root `Dockerfile` and publishes it to the GitHub Container Registry (GHCR).
78+
79+
```bash
80+
docker pull ghcr.io/decode-development/metabase-teal:latest
81+
docker pull ghcr.io/decode-development/metabase-teal:v0.61.2 # specific version
82+
```
83+
84+
**Triggers:**
85+
- Push of an upstream release tag to this fork (clean auto-merge path)
86+
- Merge of a `sync/upstream-*` PR into master (conflict-resolution path)
87+
- Manual dispatch — accepts an optional version tag, defaults to the current latest upstream release
88+
89+
> **Note:** The build compiles the full frontend and backend from source and takes approximately 60–90 minutes on a standard GitHub-hosted runner. Layer caching (`type=gha`) reduces this significantly on subsequent builds.

0 commit comments

Comments
 (0)