mirror of https://github.com/artf/grapesjs.git
Browse Source
* ci: add doc release runner * refactor: use release docs script and use commit with pkg version * releaseDocs * /docs/** * ../docs * release-docs-v * refactor: remove versionCmd and commit match * refactor: remove tag for release docspull/6244/head
committed by
GitHub
5 changed files with 82 additions and 30 deletions
@ -0,0 +1,48 @@ |
|||
name: Publish GrapesJS Docs |
|||
|
|||
on: |
|||
push: |
|||
branches: [dev] |
|||
paths: |
|||
- '/docs/**' |
|||
|
|||
jobs: |
|||
publish-docs: |
|||
runs-on: ubuntu-latest |
|||
if: "contains(github.event.head_commit.message, 'Release GrapesJS docs:')" |
|||
permissions: |
|||
contents: write |
|||
steps: |
|||
- uses: actions/checkout@v4 |
|||
- uses: ./.github/actions/setup-project |
|||
- name: Setup Git |
|||
run: | |
|||
git config --global user.name 'github-actions[bot]' |
|||
git config --global user.email 'github-actions[bot]@users.noreply.github.com' |
|||
- name: Build and Deploy Docs |
|||
env: |
|||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
|||
working-directory: ./docs |
|||
run: | |
|||
# abort on errors |
|||
set -e |
|||
# navigate into the build output directory |
|||
cd .vuepress/dist |
|||
|
|||
# Need to deploy all the documentation inside docs folder |
|||
mkdir docs-new |
|||
|
|||
# move all the files from the current directory in docs |
|||
mv `ls -1 ./ | grep -v docs-new` ./docs-new |
|||
|
|||
# fetch the current site, remove the old docs dir and make current the new one |
|||
git clone -b main https://github.com/GrapesJS/website.git tmp && mv tmp/* tmp/.* . && rm -rf tmp |
|||
rm -fR public/docs |
|||
mv ./docs-new ./public/docs |
|||
|
|||
# stage all and commit |
|||
git add -A |
|||
git commit -m 'deploy docs' |
|||
git push https://x-access-token:${GITHUB_TOKEN}@github.com/GrapesJS/website.git main |
|||
|
|||
cd - |
|||
@ -1,28 +0,0 @@ |
|||
#!/usr/bin/env sh |
|||
|
|||
# abort on errors |
|||
set -e |
|||
|
|||
# build |
|||
# npm run docs:build |
|||
|
|||
# navigate into the build output directory |
|||
cd docs/.vuepress/dist |
|||
|
|||
# Need to deploy all the documentation inside docs folder |
|||
mkdir docs-new |
|||
|
|||
# move all the files from the current directory in docs |
|||
mv `\ls -1 ./ | grep -v docs-new` ./docs-new |
|||
|
|||
# fetch the current site, remove the old docs dir and make current the new one |
|||
git clone -b main https://github.com/GrapesJS/website.git tmp && mv tmp/* tmp/.* . && rm -rf tmp |
|||
rm -fR public/docs |
|||
mv ./docs-new ./public/docs |
|||
|
|||
# stage all and commit |
|||
git add -A |
|||
git commit -m 'deploy docs' |
|||
git push https://artf@github.com/GrapesJS/website.git main |
|||
|
|||
cd - |
|||
@ -0,0 +1,32 @@ |
|||
import fs from 'fs'; |
|||
import { resolve } from 'path'; |
|||
import { runCommand } from './common'; |
|||
|
|||
const pathLib = resolve(__dirname, '../docs'); |
|||
|
|||
async function prepareCoreRelease() { |
|||
try { |
|||
// Check if the current branch is clean (no staged changes)
|
|||
runCommand( |
|||
'git diff-index --quiet HEAD --', |
|||
'You have uncommitted changes. Please commit or stash them before running the release script.', |
|||
); |
|||
|
|||
// Increment the docs version
|
|||
runCommand(`pnpm --filter @grapesjs/docs exec npm version patch --no-git-tag-version --no-commit-hooks`); |
|||
|
|||
// Create a new release branch
|
|||
const newVersion = JSON.parse(fs.readFileSync(`${pathLib}/package.json`, 'utf8')).version; |
|||
const newBranch = `release-docs-v${newVersion}`; |
|||
runCommand(`git checkout -b ${newBranch}`); |
|||
runCommand('git add .'); |
|||
runCommand(`git commit -m "Release GrapesJS docs: v${newVersion}"`); |
|||
|
|||
console.log(`Release prepared! Push the current "${newBranch}" branch and open a new PR targeting 'dev'`); |
|||
} catch (error) { |
|||
console.error(error); |
|||
process.exit(1); |
|||
} |
|||
} |
|||
|
|||
prepareCoreRelease(); |
|||
Loading…
Reference in new issue