Skip to content

Commit 9ec58b9

Browse files
Update main.yml
1 parent fa12d7a commit 9ec58b9

File tree

1 file changed

+32
-3
lines changed

1 file changed

+32
-3
lines changed

.github/workflows/main.yml

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,18 @@ name: CI
66
on:
77
# Triggers the workflow on push events but only for the master branch
88
push:
9-
branches: [ master ]
9+
branches:
10+
- master
11+
- preview
1012

1113
# Allows you to run this workflow manually from the Actions tab
1214
workflow_dispatch:
1315

1416
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
1517
jobs:
1618
# This workflow contains a single job called "build"
17-
build:
19+
Build-Master:
20+
if: ${{ github.ref == 'refs/heads/master' }}
1821
# The type of runner that the job will run on
1922
runs-on: self-hosted
2023

@@ -34,4 +37,30 @@ jobs:
3437
cd DWTDoc && bundle exec jekyll build --incremental
3538
python3 /home/ubuntu/ftp.py /home/ubuntu/DWTDoc/_site/ ./www.dynamsoft.com/web-twain/docs/ prod
3639
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

Comments
 (0)