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 '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/[^.]* . # 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' # Pass the GITHUB_TOKEN before push: https://stackoverflow.com/a/69979203 git config --unset-all http.https://github.com/.extraheader git push https://x-access-token:${GITHUB_TOKEN}@github.com/GrapesJS/website.git main cd -