Skip to content

Fix docs api (#6284) #8

Fix docs api (#6284)

Fix docs api (#6284) #8

Workflow file for this run

name: Publish GrapesJS Docs
on:
push:
branches: [dev]
paths:
- 'docs/**'
jobs:
publish-docs:
runs-on: ubuntu-latest
if: "startsWith(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 'GrapesJSBot'
git config --global user.email '[email protected]'
- name: Build and Deploy Docs
env:
GRAPESJS_BOT_TOKEN: ${{ secrets.GRAPESJS_BOT_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/[^.]* . # Move all non-hidden files
mv tmp/.[^.]* . 2>/dev/null || true # Move hidden files, ignore errors if none exist
rm -rf tmp
rm -fR public/docs
mv ./docs-new ./public/docs
# stage all and commit
git add -A
git commit -m 'deploy docs'
# Push using PAT
git push https://[email protected]/GrapesJS/website.git main
cd -