-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
53 lines (45 loc) · 1.59 KB
/
publish-docs.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
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 -