diff --git a/.github/workflows/ui-kit-publish.yml b/.github/workflows/ui-kit-publish.yml new file mode 100644 index 000000000..454d99f3d --- /dev/null +++ b/.github/workflows/ui-kit-publish.yml @@ -0,0 +1,34 @@ +name: UI Kit - Build & Publish + +on: + push: + tags: + - "ui-kit:v*" + +jobs: + publish: + runs-on: ubuntu-22.04 + steps: + - name: Check out Git repository + uses: actions/checkout@v1 + + - name: Install Node.js, NPM and Yarn + uses: actions/setup-node@v3 + with: + node-version-file: '.nvmrc' + cache: yarn + registry-url: 'https://registry.npmjs.org' + + - name: yarn install + run: yarn install --frozen-lockfile --network-timeout 100000 + + - name: Run tests + run: yarn workspace @beekeeperstudio/ui-kit run test + + - name: Build + run: yarn workspace @beekeeperstudio/ui-kit run build + + - name: Publish to npm + run: yarn workspace @beekeeperstudio/ui-kit npm publish --access public + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/apps/studio/src/services/plugin/web/cssVars.ts b/apps/studio/src/services/plugin/web/cssVars.ts index b8f1f5957..01148f805 100644 --- a/apps/studio/src/services/plugin/web/cssVars.ts +++ b/apps/studio/src/services/plugin/web/cssVars.ts @@ -54,6 +54,7 @@ export const cssVars = [ "--bks-text-editor-error-fg-color", "--bks-text-editor-fg-color", "--bks-text-editor-focused-outline-color", + "--bks-text-editor-font-size", "--bks-text-editor-foldgutter-fg-color", "--bks-text-editor-foldgutter-fg-color-hover", "--bks-text-editor-gutter-bg-color", diff --git a/apps/ui-kit/package.json b/apps/ui-kit/package.json index e72a07d94..5518b33b7 100644 --- a/apps/ui-kit/package.json +++ b/apps/ui-kit/package.json @@ -7,7 +7,7 @@ "url": "https://beekeeperstudio.io" }, "private": false, - "version": "0.3.1", + "version": "0.3.2", "repository": { "type": "git", "url": "git+https://github.com/beekeeper-studio/beekeeper-studio.git", diff --git a/bin/make-ui-kit-release.sh b/bin/make-ui-kit-release.sh new file mode 100755 index 000000000..eb22c38e6 --- /dev/null +++ b/bin/make-ui-kit-release.sh @@ -0,0 +1,114 @@ +#!/bin/bash + +set -euo pipefail + +TAG_PREFIX="ui-kit:v" + +# Function to list the 5 most recent remote ui-kit tags by date +list_recent_remote_tags() { + echo "Fetching the 5 most recent remote ui-kit tags by date:" + git ls-remote --tags origin | \ + grep -E "refs/tags/${TAG_PREFIX}[0-9]+\.[0-9]+\.[0-9]+(-[a-z]+\.[0-9]+)?$" | \ + while read -r hash ref; do + tag="${ref#refs/tags/}" + date=$(git log -1 --format='%ci' "$hash" 2>/dev/null || echo "unknown date") + echo "$tag $date" + done | sort -k2 -r | head -n 5 +} + +# Function to get the next version in sequence +guess_next_version() { + # Get the most recent ui-kit tag + local latest_tag + latest_tag=$(git ls-remote --tags origin | \ + grep -Eo "${TAG_PREFIX}[0-9]+\.[0-9]+\.[0-9]+(-[a-z]+\.[0-9]+)?$" | \ + sed "s/^${TAG_PREFIX}//" | \ + sort -V | tail -n 1) + + if [[ -z "$latest_tag" ]]; then + echo "0.1.0" + return + fi + + if [[ "$latest_tag" =~ ^([0-9]+)\.([0-9]+)\.([0-9]+)(-(alpha|beta)\.([0-9]+))?$ ]]; then + major="${BASH_REMATCH[1]}" + minor="${BASH_REMATCH[2]}" + patch="${BASH_REMATCH[3]}" + channel="${BASH_REMATCH[5]:-}" + channel_num="${BASH_REMATCH[6]:-}" + + if [[ -n "$channel" ]]; then + # Increment the channel number for pre-releases + channel_num=$((channel_num + 1)) + echo "$major.$minor.$patch-$channel.$channel_num" + else + # Increment the patch version for stable releases + patch=$((patch + 1)) + echo "$major.$minor.$patch" + fi + else + echo "0.1.0" # Default to this if no valid tags exist + fi +} + +# Function to validate version format +validate_version() { + if [[ "$1" =~ ^v?([0-9]+\.[0-9]+\.[0-9]+(-[a-z]+\.[0-9]+)?)$ ]]; then + echo "${BASH_REMATCH[1]}" + else + echo "Error: Invalid version format. Expected x.x.x or x.x.x-channel.x" + exit 1 + fi +} + +# Step 1: List recent tags +list_recent_remote_tags + +# Step 2: Prompt user for new version with a default guess +default_version=$(guess_next_version) +echo "" +read -p "Enter the new version (default: $default_version): " INPUT_VERSION +VERSION="${INPUT_VERSION:-$default_version}" + +# Step 3: Validate and clean the version +VERSION=$(validate_version "$VERSION") +NEW_TAG="${TAG_PREFIX}${VERSION}" + +# Confirm with the user +echo "" +echo "This will:" +echo " - Update apps/ui-kit/package.json to version: $VERSION" +echo " - Push a new git tag: $NEW_TAG" +read -p "Do you want to continue? (y/n): " CONFIRM + +if [[ "$CONFIRM" != "y" ]]; then + echo "Aborted." + exit 0 +fi + +# Step 4: Update package.json if necessary +PACKAGE_VERSION=$(jq -r '.version' apps/ui-kit/package.json) +if [[ "$PACKAGE_VERSION" == "$VERSION" ]]; then + echo "package.json is already updated to version $VERSION." +else + echo "Updating apps/ui-kit/package.json..." + jq ".version = \"$VERSION\"" apps/ui-kit/package.json > apps/ui-kit/package.temp.json + mv apps/ui-kit/package.temp.json apps/ui-kit/package.json + + # Commit changes + echo "Committing changes..." + git add apps/ui-kit/package.json + git commit -m "chore: bump ui-kit version to $VERSION" + git push +fi + +# Step 5: Push tag +if git tag | grep -q "^${NEW_TAG}\$"; then + echo "Tag $NEW_TAG already exists." +else + echo "Creating and pushing tag $NEW_TAG..." + git tag "$NEW_TAG" + git push origin "$NEW_TAG" +fi + +echo "UI Kit release process completed successfully."