@@ -6,15 +6,18 @@ name: CI
6
6
on :
7
7
# Triggers the workflow on push events but only for the master branch
8
8
push :
9
- branches : [ master ]
9
+ branches :
10
+ - master
11
+ - preview
10
12
11
13
# Allows you to run this workflow manually from the Actions tab
12
14
workflow_dispatch :
13
15
14
16
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
15
17
jobs :
16
18
# This workflow contains a single job called "build"
17
- build :
19
+ Build-Master :
20
+ if : ${{ github.ref == 'refs/heads/master' }}
18
21
# The type of runner that the job will run on
19
22
runs-on : self-hosted
20
23
34
37
cd DWTDoc && bundle exec jekyll build --incremental
35
38
python3 /home/ubuntu/ftp.py /home/ubuntu/DWTDoc/_site/ ./www.dynamsoft.com/web-twain/docs/ prod
36
39
37
-
40
+ Build-Preview :
41
+ if : ${{ github.ref == 'refs/heads/preview' }}
42
+ # The type of runner that the job will run on
43
+ runs-on : self-hosted
44
+
45
+ # Steps represent a sequence of tasks that will be executed as part of the job
46
+ steps :
47
+ # Runs a set of commands using the runners shell
48
+ - name : Build the site
49
+ run : |
50
+ cd /home/ubuntu
51
+ [ ! -d web-twain-docs-preview ] && git clone --depth 1 --branch preview https://github.com/Dynamsoft/web-twain-docs.git web-twain-docs-preview
52
+ [ ! -d DWTDocPreview ] && mkdir -p DWTDocPreview
53
+ cd web-twain-docs-preview && git pull && cd .. && cp -rfp ./web-twain-docs-preview/* ./DWTDocPreview/
54
+ cd Docs-Template-Repo && git pull && cd .. && cp -rfp ./Docs-Template-Repo/* ./DWTDocPreview/
55
+ sed -i -e "1,3s/blob\/master$/blob\/preview/" \
56
+ -e "1,3s/blob\/main$/blob\/preview/" /home/ubuntu/DWTDocPreview/_config.yml
57
+ cd DWTDocPreview && bundle exec jekyll build --incremental
58
+ - name : Sync files
59
+ uses : SamKirkland/FTP-Deploy-Action@4.3.0
60
+ with :
61
+ server : ${{ secrets.FTP_TEST_SITE_SERVER }}
62
+ username : ${{ secrets.FTP_TEST_SITE_USER }}
63
+ password : ${{ secrets.FTP_TEST_SITE_PASSWORD }}
64
+ port : 7500
65
+ local-dir : /home/ubuntu/DWTDocPreview/_site/
66
+ server-dir : /www.dynamsoft.com/web-twain/docs/
0 commit comments