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
9 changes: 9 additions & 0 deletions .github/actions/setup-project/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,12 @@ runs:
- name: Install dependencies
run: yarn
shell: bash

- name: Install React Dependencies in Root
shell: bash
run: |
cd ./packages/grapesjs-react && yarn add \
react@^19.0.0 \
react-dom@^19.0.0 \
@types/react@^19.0.0 \
@types/react-dom@^19.0.0
9 changes: 0 additions & 9 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,6 @@ jobs:
- name: Setup Project Base
uses: ./.github/actions/setup-project

## We specify the version of react and react-dom we want to run vite build with
- name: Install React Dependencies in Root
run: |
cd ./packages/grapesjs-react && yarn add \
react@^19.0.0 \
react-dom@^19.0.0 \
@types/react@^19.0.0 \
@types/react-dom@^19.0.0

- name: Build Core
run: yarn workspace @grapesjs/react run build

Expand Down
22 changes: 22 additions & 0 deletions .github/workflows/release-grapesjs-react-latest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Publish GrapesJS React latest
on:
push:
branches: [main]

jobs:
publish:
if: "contains(github.event.head_commit.message, 'Release GrapesJS React latest:')"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup project
uses: ./.github/actions/setup-project
- name: Build
run: yarn build:core
- name: Publish to npm
env:
NODE_AUTH_TOKEN: ${{ secrets.ORG_NPM_TOKEN }}
run: |
echo "//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}" >> ./packages/grapesjs-react/.npmrc
yarn publish:core:latest
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
"clean": "find . -type d \\( -name \"node_modules\" -o -name \"build\" -o -name \"dist\" \\) -exec rm -rf {} + && rm ./yarn.lock",
"build:core": "yarn workspace @grapesjs/react run build",
"build:app-18": "yarn workspace @grapesjs/react-app-18 run build",
"build:app-19": "yarn workspace @grapesjs/react-app-19 run build"
"build:app-19": "yarn workspace @grapesjs/react-app-19 run build",
"release:core:latest": "ts-node scripts/releaseCore latest",
"publish:core:latest": "cd packages/grapesjs-react && npm publish --access public"
},
"workspaces": {
"packages": [
Expand Down
10 changes: 10 additions & 0 deletions scripts/common.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { execSync } from "child_process";

export function runCommand(command: string, error?: string) {
try {
return (execSync(command, { stdio: "inherit" }) || "").toString().trim();
} catch (err) {
console.error(error || `Error while running command: ${command}`);
throw err;
}
}
45 changes: 45 additions & 0 deletions scripts/releaseCore.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import fs from "fs";
import { resolve } from "path";
import { runCommand } from "./common";

const grapesJSReactPath = resolve(__dirname, "../packages/grapesjs-react");

async function prepareReleaseGrapesJSReact() {
try {
const releaseTag = process.argv[2] || "rc";
console.log("Prepare release GrapesJS tag:", releaseTag);

runCommand(
"git diff-index --quiet HEAD --",
"You have uncommitted changes. Please commit or stash them before running the release script."
);

const versionCmd =
releaseTag === "latest"
? "--patch"
: `--prerelease --preid ${releaseTag}`;
runCommand(
`yarn workspace @grapesjs/react version ${versionCmd} --no-git-tag-version --no-commit-hooks`
);

// Create a new release branch
const newVersion = JSON.parse(
fs.readFileSync(`${grapesJSReactPath}/package.json`, "utf8")
).version;
const newBranch = `release-v${newVersion}`;
runCommand(`git checkout -b ${newBranch}`);
runCommand("git add .");
runCommand(
`git commit -m "Release GrapesJS React ${releaseTag}: v${newVersion}"`
);

console.log(
`Release prepared! Push the current "${newBranch}" branch and open a new PR targeting 'main'`
);
} catch (error) {
console.error(error);
process.exit(1);
}
}

prepareReleaseGrapesJSReact();