Check the Metabase SDK version and create a version branch #183
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Check the Metabase SDK version and create a version branch | |
on: | |
schedule: | |
- cron: '0 * * * *' # every hour | |
workflow_dispatch: | |
jobs: | |
update_release_branch: | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 5 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Get TARGET_BRANCH from latest stable major version of @metabase/embedding-sdk-react | |
id: get-target-branch | |
run: | | |
LATEST_VERSION=$(npm view @metabase/embedding-sdk-react version) | |
MAJOR_VERSION=$(echo "$LATEST_VERSION" | cut -d. -f2) | |
TARGET_BRANCH="${MAJOR_VERSION}-stable" | |
echo "target_branch=$TARGET_BRANCH" >> $GITHUB_OUTPUT | |
- name: Check if target branch exists | |
id: check-target-branch | |
run: | | |
if git ls-remote --exit-code --heads origin "${{ steps.get-target-branch.outputs.target_branch }}"; then | |
echo "target_branch_exists=true" >> $GITHUB_OUTPUT | |
else | |
echo "target_branch_exists=false" >> $GITHUB_OUTPUT | |
fi | |
- name: Create target branch if it doesn't exist | |
if: steps.check-target-branch.outputs.target_branch_exists == 'false' | |
run: | | |
TARGET_BRANCH="${{ steps.get-target-branch.outputs.target_branch }}" | |
echo "Creating branch $TARGET_BRANCH from main" | |
git fetch origin main | |
git checkout -b "$TARGET_BRANCH" origin/main | |
git push origin "$TARGET_BRANCH" |