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
2 changes: 2 additions & 0 deletions .changeset/wise-vans-thank.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
8 changes: 8 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- main
pull_request:

name: Release

Expand All @@ -13,6 +14,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-node@v4
with:
Expand Down Expand Up @@ -60,10 +63,15 @@ jobs:
key: ${{ runner.os }}-ultra-v1-${{ github.head_ref || github.ref_name }}-${{ github.sha }}

- name: Create PR or release packages
if: github.event_name == 'push'
uses: changesets/action@v1
with:
publish: yarn changeset publish
version: yarn changeset:version
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
GITHUB_TOKEN: ${{ github.token }}

- name: Continuous release via pkg.pr.new
if: github.event_name == 'pull_request'
run: ./scripts/publish-preview-packages.sh ${{ github.event.pull_request.base.ref }}
15 changes: 11 additions & 4 deletions demo/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"baseUrl": "./src",
"outDir": "./dist",
"target": "ESNext",
"jsx": "react-jsx",
"module": "ESNext",
"moduleResolution": "Bundler"
"moduleResolution": "Bundler",
"declaration": true,
"declarationMap": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"skipLibCheck": false,
"baseUrl": "./src",
"outDir": "./dist"
},
"exclude": ["./dist", "./build"]
}
58 changes: 58 additions & 0 deletions scripts/publish-preview-packages.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#!/bin/bash

if [ -z "$1" ]; then
echo "Error: Base branch not specified. Usage: publish-previews.sh <base-branch>"
exit 1
fi

BASE_BRANCH=$1

# ensure we have the latest changes from the remote
git fetch origin

if ! git show-ref --verify --quiet refs/remotes/origin/"$BASE_BRANCH"; then
echo "Error: Base branch '$BASE_BRANCH' not found in the remote repository."
exit 1
fi

echo "Detecting changed packages compared to $BASE_BRANCH..."

# Get changes from all relevant directories
CHANGED_PATHS=$(git diff --name-only origin/"$BASE_BRANCH"...HEAD | grep -E '^(config|core|extensions/|integrations/|packages/)' | sort -u)

if [ -z "$CHANGED_PATHS" ]; then
echo "No changed packages detected."
exit 0
fi

# Process each changed path and format it for publishing
PUBLISH_PATHS=""
while IFS= read -r path; do
case "$path" in
config/*|core/*)
# For config and core, include the first directory
dir=$(echo "$path" | cut -d '/' -f 1)
if [[ ! "$PUBLISH_PATHS" =~ "./$dir " ]]; then
PUBLISH_PATHS+="./$dir "
fi
;;
extensions/*|integrations/*|packages/*)
# For extensions, integrations, and packages, include the full path up to the second level
dir=$(echo "$path" | cut -d '/' -f 1-2)
if [[ ! "$PUBLISH_PATHS" =~ "./$dir " ]]; then
PUBLISH_PATHS+="./$dir "
fi
;;
esac
done <<< "$CHANGED_PATHS"

# Remove trailing space
PUBLISH_PATHS="${PUBLISH_PATHS% }"

if [ -n "$PUBLISH_PATHS" ]; then
echo "Publishing changed packages: $PUBLISH_PATHS"
yarn dlx pkg-pr-new publish --compact $PUBLISH_PATHS --packageManager yarn --template './demo'
else
echo "No publishable packages found."
exit 0
fi
Loading