Skip to content

Commit cecadc3

Browse files
committed
Update version branch workflow (#26)
(cherry picked from commit 4e1b738)
1 parent 84bf7d2 commit cecadc3

File tree

3 files changed

+40
-52
lines changed

3 files changed

+40
-52
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Check the Metabase SDK version and create a version branch
2+
3+
on:
4+
schedule:
5+
- cron: '0 * * * *' # every hour
6+
workflow_dispatch:
7+
8+
jobs:
9+
update_release_branch:
10+
runs-on: ubuntu-22.04
11+
timeout-minutes: 5
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- name: Get TARGET_BRANCH from latest stable major version of @metabase/embedding-sdk-react
16+
id: get-target-branch
17+
run: |
18+
LATEST_VERSION=$(npm view @metabase/embedding-sdk-react version)
19+
MAJOR_VERSION=$(echo "$LATEST_VERSION" | cut -d. -f2)
20+
TARGET_BRANCH="${MAJOR_VERSION}-stable"
21+
echo "target_branch=$TARGET_BRANCH" >> $GITHUB_OUTPUT
22+
23+
- name: Check if target branch exists
24+
id: check-target-branch
25+
run: |
26+
if git ls-remote --exit-code --heads origin "${{ steps.get-target-branch.outputs.target_branch }}"; then
27+
echo "target_branch_exists=true" >> $GITHUB_OUTPUT
28+
else
29+
echo "target_branch_exists=false" >> $GITHUB_OUTPUT
30+
fi
31+
32+
- name: Create target branch if it doesn't exist
33+
if: steps.check-target-branch.outputs.target_branch_exists == 'false'
34+
run: |
35+
TARGET_BRANCH="${{ steps.get-target-branch.outputs.target_branch }}"
36+
echo "Creating branch $TARGET_BRANCH from main"
37+
git fetch origin main
38+
git checkout -b "$TARGET_BRANCH" origin/main
39+
git push origin "$TARGET_BRANCH"

.github/workflows/update-default-branch.yml

-51
This file was deleted.

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
> [!IMPORTANT]
2-
> **To use your own Metabase**, use the release branch that matches your Metabase Enterprise Edition's major version. For example, if you're using Metabase 1.53.x, use the `release-x.53.x` branch. [More info](https://www.metabase.com/docs/latest/embedding/sdk/version).
2+
> **To use your own Metabase**, use the release branch that matches your Metabase Enterprise Edition's major version. For example, if you're using Metabase 1.53.x, use the `53-stable` branch. [More info](https://www.metabase.com/docs/latest/embedding/sdk/version).
33
>
44
> **To spin up a new Metabase**, you can use any version branch and run the sample app in the Docker container with the corresponding version of Metabase. You'll need a Pro/Enterprise token, which you can get with a [free trial of Pro](https://www.metabase.com/pricing/).
55

0 commit comments

Comments
 (0)