File tree Expand file tree Collapse file tree 6 files changed +89
-10
lines changed Expand file tree Collapse file tree 6 files changed +89
-10
lines changed Original file line number Diff line number Diff line change 18
18
- name : Install dependencies
19
19
run : yarn
20
20
shell : bash
21
+
22
+ - name : Install React Dependencies in Root
23
+ shell : bash
24
+ run : |
25
+ cd ./packages/grapesjs-react && yarn add \
26
+ react@^19.0.0 \
27
+ react-dom@^19.0.0 \
28
+ @types/react@^19.0.0 \
29
+ @types/react-dom@^19.0.0
Original file line number Diff line number Diff line change 30
30
- name : Setup Project Base
31
31
uses : ./.github/actions/setup-project
32
32
33
- # # We specify the version of react and react-dom we want to run vite build with
34
- - name : Install React Dependencies in Root
35
- run : |
36
- cd ./packages/grapesjs-react && yarn add \
37
- react@^19.0.0 \
38
- react-dom@^19.0.0 \
39
- @types/react@^19.0.0 \
40
- @types/react-dom@^19.0.0
41
-
42
33
- name : Build Core
43
34
run : yarn workspace @grapesjs/react run build
44
35
Original file line number Diff line number Diff line change
1
+ name : Publish GrapesJS React latest
2
+ on :
3
+ push :
4
+ branches : [main]
5
+
6
+ jobs :
7
+ publish :
8
+ if : " contains(github.event.head_commit.message, 'Release GrapesJS React latest:')"
9
+ runs-on : ubuntu-latest
10
+ steps :
11
+ - name : Checkout
12
+ uses : actions/checkout@v4
13
+ - name : Setup project
14
+ uses : ./.github/actions/setup-project
15
+ - name : Build
16
+ run : yarn build:core
17
+ - name : Publish to npm
18
+ env :
19
+ NODE_AUTH_TOKEN : ${{ secrets.ORG_NPM_TOKEN }}
20
+ run : |
21
+ echo "//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}" >> ./packages/grapesjs-react/.npmrc
22
+ yarn publish:core:latest
Original file line number Diff line number Diff line change 8
8
"clean" : " find . -type d \\ ( -name \" node_modules\" -o -name \" build\" -o -name \" dist\" \\ ) -exec rm -rf {} + && rm ./yarn.lock" ,
9
9
"build:core" : " yarn workspace @grapesjs/react run build" ,
10
10
"build:app-18" : " yarn workspace @grapesjs/react-app-18 run build" ,
11
- "build:app-19" : " yarn workspace @grapesjs/react-app-19 run build"
11
+ "build:app-19" : " yarn workspace @grapesjs/react-app-19 run build" ,
12
+ "release:core:latest" : " ts-node scripts/releaseCore latest" ,
13
+ "publish:core:latest" : " cd packages/grapesjs-react && npm publish --access public"
12
14
},
13
15
"workspaces" : {
14
16
"packages" : [
Original file line number Diff line number Diff line change
1
+ import { execSync } from "child_process" ;
2
+
3
+ export function runCommand ( command : string , error ?: string ) {
4
+ try {
5
+ return ( execSync ( command , { stdio : "inherit" } ) || "" ) . toString ( ) . trim ( ) ;
6
+ } catch ( err ) {
7
+ console . error ( error || `Error while running command: ${ command } ` ) ;
8
+ throw err ;
9
+ }
10
+ }
Original file line number Diff line number Diff line change
1
+ import fs from "fs" ;
2
+ import { resolve } from "path" ;
3
+ import { runCommand } from "./common" ;
4
+
5
+ const grapesJSReactPath = resolve ( __dirname , "../packages/grapesjs-react" ) ;
6
+
7
+ async function prepareReleaseGrapesJSReact ( ) {
8
+ try {
9
+ const releaseTag = process . argv [ 2 ] || "rc" ;
10
+ console . log ( "Prepare release GrapesJS tag:" , releaseTag ) ;
11
+
12
+ runCommand (
13
+ "git diff-index --quiet HEAD --" ,
14
+ "You have uncommitted changes. Please commit or stash them before running the release script."
15
+ ) ;
16
+
17
+ const versionCmd =
18
+ releaseTag === "latest"
19
+ ? "--patch"
20
+ : `--prerelease --preid ${ releaseTag } ` ;
21
+ runCommand (
22
+ `yarn workspace @grapesjs/react version ${ versionCmd } --no-git-tag-version --no-commit-hooks`
23
+ ) ;
24
+
25
+ // Create a new release branch
26
+ const newVersion = JSON . parse (
27
+ fs . readFileSync ( `${ grapesJSReactPath } /package.json` , "utf8" )
28
+ ) . version ;
29
+ const newBranch = `release-v${ newVersion } ` ;
30
+ runCommand ( `git checkout -b ${ newBranch } ` ) ;
31
+ runCommand ( "git add ." ) ;
32
+ runCommand (
33
+ `git commit -m "Release GrapesJS React ${ releaseTag } : v${ newVersion } "`
34
+ ) ;
35
+
36
+ console . log (
37
+ `Release prepared! Push the current "${ newBranch } " branch and open a new PR targeting 'main'`
38
+ ) ;
39
+ } catch ( error ) {
40
+ console . error ( error ) ;
41
+ process . exit ( 1 ) ;
42
+ }
43
+ }
44
+
45
+ prepareReleaseGrapesJSReact ( ) ;
You can’t perform that action at this time.
0 commit comments