Skip to content
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
104 changes: 104 additions & 0 deletions .github/workflows/update-version-support.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
name: Update version support data

on:
workflow_dispatch:
schedule:
# Nightly, an hour before the nightly docs update
- cron: "0 1 * * *"

run-name: Nightly version support update

env:
VERSION_INFO_URL: https://static.metabase.com/version-info.json
DATA_FILE: _data/major_version_support.json

concurrency:
group: update-version-support
cancel-in-progress: false

jobs:
update:
name: Update major_version_support.json
runs-on: ubuntu-latest
timeout-minutes: 10
env:
GH_TOKEN: ${{ secrets.METABASE_AUTOMATION_USER_TOKEN }}
BRANCH_NAME: update-version-support-${{ github.run_id }}
steps:
- uses: actions/checkout@v6
with:
ref: master
token: ${{ secrets.METABASE_AUTOMATION_USER_TOKEN }}

- name: Fetch major_version_support from version-info.json
run: |
curl --fail --silent --show-error --retry 3 --retry-delay 5 \
"$VERSION_INFO_URL" -o version-info.json

# Bail out rather than commit garbage if the key is missing or empty
if ! jq -e '.major_version_support | arrays and length > 0' version-info.json > /dev/null; then
echo "::error::major_version_support is missing or empty in $VERSION_INFO_URL"
exit 1
fi

# Every entry needs a numeric major, otherwise the docs templates can't match on it
if ! jq -e '.major_version_support | all(.major | numbers)' version-info.json > /dev/null; then
echo "::error::every major_version_support entry must have a numeric \"major\""
exit 1
fi

jq '.major_version_support' version-info.json > "$DATA_FILE"
rm version-info.json

- name: Check for changes
id: diff
run: |
if git diff --quiet -- "$DATA_FILE"; then
echo "changed=false" >> "$GITHUB_OUTPUT"
echo "No changes to $DATA_FILE"
else
echo "changed=true" >> "$GITHUB_OUTPUT"
git --no-pager diff -- "$DATA_FILE"
fi

- name: Push the update
if: steps.diff.outputs.changed == 'true'
run: |
git config user.name github-actions
git config user.email github-actions@github.com

git checkout -B "$BRANCH_NAME"
git add "$DATA_FILE"
git commit -m "Update major version support data"
git push --force origin "$BRANCH_NAME"

- name: Open PR
id: create_pr
if: steps.diff.outputs.changed == 'true'
env:
GH_TOKEN: ${{ secrets.METABASE_AUTOMATION_USER_TOKEN }}
run: | # sh
DATE=$(date +'%Y-%m-%d')

URL=$(gh pr create \
--base master \
--head "$BRANCH_NAME" \
--title "Update version support data $DATE" \
--body "Automated nightly update of major version support data.")

PR_NUMBER=${URL##*/}
echo "pr_number=$PR_NUMBER" >> "$GITHUB_OUTPUT"

- name: Auto approve PR
if: steps.diff.outputs.changed == 'true'
uses: juliangruber/approve-pull-request-action@68fcc9a5a73b5641cadf757cf99d73720dcb05d0 # v2.1.0
with:
github-token: ${{ github.token }}
number: ${{ steps.create_pr.outputs.pr_number }}

- name: Enable Pull Request Automerge
if: steps.diff.outputs.changed == 'true'
run: gh pr merge --squash --auto "$PR_NUMBER"
env:
GH_TOKEN: ${{ secrets.METABASE_AUTOMATION_USER_TOKEN }}
PR_NUMBER: ${{ steps.create_pr.outputs.pr_number }}
1 change: 1 addition & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ whitelist:
- jekyll_include_plugin
- jekyll_dirname_payload_plugin
- jekyll_responsive_table_labels_plugin
- jekyll_version_support_plugin
jekyll_include_plugin:
snippet_prefix: ""
sass:
Expand Down
62 changes: 62 additions & 0 deletions _data/major_version_support.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
[
{
"major": 63,
"released": "2026-07-07",
"lts": false,
"eol": "2026-09-07"
},
{
"major": 62,
"released": "2026-06-01",
"lts": false,
"eol": "2026-09-01"
},
{
"major": 61,
"released": "2026-04-30",
"lts": false,
"eol": "2026-09-01"
},
{
"major": 60,
"released": "2026-03-26",
"lts": false,
"eol": "2026-09-01"
},
{
"major": 59,
"released": "2026-02-12",
"lts": false,
"eol": "2026-09-01"
},
{
"major": 58,
"released": "2025-12-17",
"lts": true,
"eol": "2027-02-17"
},
{
"major": 57,
"released": "2025-11-01",
"lts": false,
"eol": "2026-05-31"
},
{
"major": 56,
"released": "2025-08-01",
"lts": false,
"eol": "2026-05-31"
},
{
"major": 55,
"released": "2025-06-02",
"lts": false,
"eol": "2026-05-31"
},
{
"major": 54,
"released": "2025-03-25",
"lts": false,
"eol": "2026-05-31"
}
]
15 changes: 11 additions & 4 deletions _includes/docs/blockquotes.html

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alexyarosh I'm sure you'll want to wordsmith this a bit, but you might also want to think about the logic around when we should show which block. I like what I did here, but I'd defer to your judgment.

Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,17 @@
Check out the <a class="text-purple text-underline" href="/docs/latest/">docs for the current stable version, Metabase {{site.docs_version}}.</a>
</blockquote>
{% else %}
<blockquote>
These are the docs for Metabase {{ page.version }}.
Check out the <a class="text-purple text-underline" href="/docs/latest/">docs for the current stable version, Metabase {{site.docs_version}}.</a>
</blockquote>
{% assign support = site.data.version_support[page.version] %}
{% if support.status == "unsupported" %}
<blockquote class="version-unsupported-notice">
Version {{ page.version }} of Metabase is <strong><a class="text-purple text-underline" href="/version-support">no longer supported</a></strong>. Check out the <a class="text-purple text-underline" href="/docs/latest/">docs for the current stable version, Metabase {{site.docs_version}}.</a>
</blockquote>
{% else %}
<blockquote>
These are the docs for Metabase {{ page.version }}.
Check out the <a class="text-purple text-underline" href="/docs/latest/">docs for the current stable version, Metabase {{site.docs_version}}.</a>
</blockquote>
{% endif %}
{% endif %}
{% endif %}
</div>
12 changes: 11 additions & 1 deletion _includes/docs_version.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,19 @@
<ul class="version__dropdown">
{% for version in versions limit: 10 %}
{% unless page.version == version %}
{% assign support = site.data.version_support[version] %}
<li>
<a href="/docs/{{ version }}">
{{version}}
<div class="version__dropdown--item">
<span>
{{version}}
</span>
{% if support.status == "unsupported" %}
<span class="version__tag version__tag--unsupported">unsupported</span>
{% elsif support.lts %}
<span class="version__tag version__tag--lts">lts</span>
{% endif %}
</div>
</a>
</li>
{% endunless %}
Expand Down
6 changes: 6 additions & 0 deletions _includes/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
{% include shared-chrome/stylesheets.html %}

{% comment %}
Loaded after the shared chrome so it can override those stylesheets. Must stay
outside the canonical-URL block above, which skips versioned docs pages.
{% endcomment %}
<link rel="stylesheet" href="/docs/docs-local.css" />

{% if page.url contains "/data-stack-report-2023/" %}
<!-- Cooper Font -->
<link rel="stylesheet" href="https://use.typekit.net/tiw6flt.css" />
Expand Down
8 changes: 8 additions & 0 deletions _layouts/docs.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ <h2>
{% include docs-old-breadcrumbs.html %}
{% endif %}

{% assign support = site.data.version_support[page.version] %}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unrelated to this PR, but god i really wish all the pages that use this layout would just be in cold storage... we switched in v42??? or something? anything that still used this layout should be dead (if not for the couple hundred people every month that for some reason still visit these)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should discuss "cold storage" some more when brad is back, we've talked a little about it, but it could mean several different things, technically

{% if support.status == "unsupported" %}
<blockquote class="version-unsupported-notice">
Version {{ page.version }} of Metabase is no longer <a href="/version-support">supported</a>.
Check out the <a href="/docs/latest/">docs for the current stable version, Metabase {{site.docs_version}}.</a>
</blockquote>
{% endif %}

{{ content }}

</div>
Expand Down
77 changes: 77 additions & 0 deletions _plugins/jekyll_version_support_plugin.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# Builds `site.data.version_support`, a lookup table of support status keyed by

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm just gonna say "sure, whatever" to this file 😅

# the version strings used throughout the site ("v0.63", "v0.57", ...).
#
# The source data is _data/major_version_support.json, refreshed nightly from
# the `major_version_support` key of https://static.metabase.com/version-info.json
# by .github/workflows/update-version-support.yml
#
# Templates just look a version up:
#
# {% assign support = site.data.version_support[page.version] %}
# {% if support.status == "unsupported" %}...{% endif %}
# {% if support.lts %}...{% endif %}
#
# The data file only tracks the most recent majors, so anything older than the
# oldest tracked major is unsupported. Versions with no entry and no verdict
# (such as "latest" and "master") are simply absent from the table, and a
# missing key renders as nil in Liquid — so callers need no special casing.
module Jekyll
class VersionSupportGenerator < Generator
safe true
priority :high

SUPPORTED = "supported".freeze
UNSUPPORTED = "unsupported".freeze

def generate(site)
entries = site.data["major_version_support"] || []
by_major = entries.each_with_object({}) do |entry, acc|
major = entry["major"]
acc[major.to_i] = entry if major
end

oldest_tracked = by_major.keys.min
today = site.time.to_date

site.data["version_support"] = Array(site.config["available_versions"])
.each_with_object({}) do |version, acc|
major = major_of(version)
status = status_for(major, by_major, oldest_tracked, today)
next if status.nil?

acc[version] = {
"status" => status,
"lts" => by_major.dig(major, "lts") || false,
}
end
end

private

# "v0.63" -> 63
def major_of(version)
version.to_s[/\Av\d+\.(\d+)\z/, 1]&.to_i
end

def status_for(major, by_major, oldest_tracked, today)
return nil if major.nil?

entry = by_major[major]
return UNSUPPORTED if entry.nil? && oldest_tracked && major < oldest_tracked
return nil if entry.nil?

eol = parse_date(entry["eol"])
return SUPPORTED if eol.nil?

eol <= today ? UNSUPPORTED : SUPPORTED
end

def parse_date(value)
return value.to_date if value.respond_to?(:to_date) && !value.is_a?(String)

Date.parse(value.to_s)
rescue ArgumentError, TypeError
nil
end
end
end
5 changes: 4 additions & 1 deletion all.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ We version our docs for every major release, with docs for each major release co

For product releases, see the list of [Metabase releases](https://github.com/metabase/metabase/releases).

Versions marked <span class="version__tag version__tag--unsupported">unsupported</span> have passed their end-of-life date. See our [version support policy](/version-support) for details.

{% for version in site.available_versions reversed %}
{% assign support = site.data.version_support[version] %}

- [{{ version }}](/docs/{{ version }}/)
- [{{ version }}](/docs/{{ version }}/){% if support.status == "unsupported" %} <span class="version__tag version__tag--unsupported">unsupported</span>{% elsif support.lts %} <span class="version__tag version__tag--lts">lts</span>{% endif %}
{% endfor %}
55 changes: 55 additions & 0 deletions docs/docs-local.css

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

currently all the .scss is build in the marketing repo. this is a band-aid for some docs specific styling for now.

Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/* because stylesheets mainly live in the marketing repo, this is a subset of the styles
* that are specific to this repo, pending a larger refactor to move all docs-specific styles into this repo. */

.bootstrap .learn .version__dropdown {
width: auto !important;

.version__dropdown--item {
align-items: center;
display: flex;
flex-wrap: nowrap;
gap: 0.5rem;
justify-content: space-between;
padding-inline: 1rem;
text-align: left;
}
}

.version__tag {
border-radius: 4px;
font-size: 10px;
font-weight: 700;
letter-spacing: 0.02em;
line-height: 1;
padding: 3px 5px;
text-transform: uppercase;
}

.version__tag--unsupported {
background-color: #f1f2f4;
color: #5a6072;
}

.version__tag--lts {
background-color: #f3faec;
color: #669438;
}

/* Notice on docs for versions past their EOL date. The `.docs` ancestor is
* present in both the current and legacy layouts, and matches the specificity
* of the blockquote rules in css/styles.css and css/docs.css — this file wins
* the tie because it's the last stylesheet in the head. */
.docs blockquote.version-unsupported-notice {
background-color: #fef9e6;
border: 1px solid #f7be08;
border-radius: 0.625rem;
color: #4c5773;
font-size: 14px;
line-height: 1.5;
margin: 1.5rem 0;
padding: 0.75rem 1rem;
}

.docs blockquote.version-unsupported-notice a {
display: inline;
}