File tree 5 files changed +82
-30
lines changed
5 files changed +82
-30
lines changed Original file line number Diff line number Diff line change
1
+ name : Publish GrapesJS Docs
2
+
3
+ on :
4
+ push :
5
+ branches : [dev]
6
+ paths :
7
+ - ' /docs/**'
8
+
9
+ jobs :
10
+ publish-docs :
11
+ runs-on : ubuntu-latest
12
+ if : " contains(github.event.head_commit.message, 'Release GrapesJS docs:')"
13
+ permissions :
14
+ contents : write
15
+ steps :
16
+ - uses : actions/checkout@v4
17
+ - uses : ./.github/actions/setup-project
18
+ - name : Setup Git
19
+ run : |
20
+ git config --global user.name 'github-actions[bot]'
21
+ git config --global user.email 'github-actions[bot]@users.noreply.github.com'
22
+ - name : Build and Deploy Docs
23
+ env :
24
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
25
+ working-directory : ./docs
26
+ run : |
27
+ # abort on errors
28
+ set -e
29
+ # navigate into the build output directory
30
+ cd .vuepress/dist
31
+
32
+ # Need to deploy all the documentation inside docs folder
33
+ mkdir docs-new
34
+
35
+ # move all the files from the current directory in docs
36
+ mv `ls -1 ./ | grep -v docs-new` ./docs-new
37
+
38
+ # fetch the current site, remove the old docs dir and make current the new one
39
+ git clone -b main https://github.com/GrapesJS/website.git tmp && mv tmp/* tmp/.* . && rm -rf tmp
40
+ rm -fR public/docs
41
+ mv ./docs-new ./public/docs
42
+
43
+ # stage all and commit
44
+ git add -A
45
+ git commit -m 'deploy docs'
46
+ git push https://x-access-token:${GITHUB_TOKEN}@github.com/GrapesJS/website.git main
47
+
48
+ cd -
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 34
34
"scripts" : {
35
35
"docs" : " vuepress dev ." ,
36
36
"docs:api" : " node ./api.mjs" ,
37
- "build" : " npm run docs:api && vuepress build ." ,
38
- "docs:deploy" : " ./deploy.sh"
37
+ "build" : " npm run docs:api && vuepress build ."
39
38
}
40
39
}
Original file line number Diff line number Diff line change 21
21
"publish:core:rc" : " cd packages/core && npm publish --tag rc --access public" ,
22
22
"publish:core:latest" : " cd packages/core && npm publish --access public" ,
23
23
"build:core" : " pnpm --filter grapesjs build" ,
24
+ "release:docs" : " ts-node scripts/releaseDocs latest" ,
24
25
"build:cli" : " pnpm --filter grapesjs-cli build" ,
25
26
"build:docs:api" : " pnpm --filter @grapesjs/docs docs:api" ,
26
27
"build:docs" : " pnpm --filter @grapesjs/docs build"
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 pathLib = resolve ( __dirname , '../docs' ) ;
6
+
7
+ async function prepareCoreRelease ( ) {
8
+ try {
9
+ // Check if the current branch is clean (no staged changes)
10
+ runCommand (
11
+ 'git diff-index --quiet HEAD --' ,
12
+ 'You have uncommitted changes. Please commit or stash them before running the release script.' ,
13
+ ) ;
14
+
15
+ // Increment the docs version
16
+ runCommand ( `pnpm --filter @grapesjs/docs exec npm version patch --no-git-tag-version --no-commit-hooks` ) ;
17
+
18
+ // Create a new release branch
19
+ const newVersion = JSON . parse ( fs . readFileSync ( `${ pathLib } /package.json` , 'utf8' ) ) . version ;
20
+ const newBranch = `release-docs-v${ newVersion } ` ;
21
+ runCommand ( `git checkout -b ${ newBranch } ` ) ;
22
+ runCommand ( 'git add .' ) ;
23
+ runCommand ( `git commit -m "Release GrapesJS docs: v${ newVersion } "` ) ;
24
+
25
+ console . log ( `Release prepared! Push the current "${ newBranch } " branch and open a new PR targeting 'dev'` ) ;
26
+ } catch ( error ) {
27
+ console . error ( error ) ;
28
+ process . exit ( 1 ) ;
29
+ }
30
+ }
31
+
32
+ prepareCoreRelease ( ) ;
You can’t perform that action at this time.
0 commit comments