-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
48 lines (41 loc) · 1.46 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
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/* 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 -