Skip to content

Commit ffac988

Browse files
Create full-site-build.yml
1 parent 9ec58b9 commit ffac988

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed

.github/workflows/full-site-build.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# This is a basic workflow to help you get started with Actions
2+
3+
name: Full-Site-Build
4+
5+
# Controls when the workflow will run
6+
on:
7+
# Allows you to run this workflow manually from the Actions tab
8+
workflow_dispatch:
9+
10+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
11+
jobs:
12+
# This workflow contains jobs called "Build-Master" and "Build-Preview"
13+
Build-Master:
14+
if: ${{ github.ref == 'refs/heads/master' }}
15+
# The type of runner that the job will run on
16+
runs-on: self-hosted
17+
18+
# Steps represent a sequence of tasks that will be executed as part of the job
19+
steps:
20+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
21+
#- uses: actions/checkout@v2
22+
23+
# Runs a set of commands using the runners shell
24+
- name: Build and Upload to Prod Env
25+
run: |
26+
cd /home/ubuntu
27+
[ -d DWTDoc ] && rm -rf DWTDoc
28+
[ -d web-twain-docs ] && rm -rf web-twain-docs
29+
mkdir -p DWTDoc
30+
git clone --depth 1 https://github.com/dynamsoft-docs/web-twain-docs.git web-twain-docs
31+
cp -rfp ./web-twain-docs/* ./DWTDoc/
32+
cd Docs-Template-Repo && git pull && cd .. && cp -rfp ./Docs-Template-Repo/* ./DWTDoc/
33+
cd DWTDoc && bundle exec jekyll build
34+
python3 /home/ubuntu/ftp.py /home/ubuntu/DWTDoc/_site/ ./www.dynamsoft.com/web-twain/docs/ prod
35+
36+
Build-Preview:
37+
if: ${{ github.ref == 'refs/heads/preview' }}
38+
# The type of runner that the job will run on
39+
runs-on: self-hosted
40+
41+
# Steps represent a sequence of tasks that will be executed as part of the job
42+
steps:
43+
44+
# Runs a set of commands using the runners shell
45+
- name: Build the site
46+
run: |
47+
cd /home/ubuntu
48+
[ -d DWTDocPreview ] && rm -rf DWTDocPreview
49+
[ -d web-twain-docs-preview ] && rm -rf web-twain-docs-preview
50+
mkdir -p DWTDocPreview
51+
git clone --depth 1 --branch preview https://github.com/dynamsoft-docs/web-twain-docs.git web-twain-docs-preview
52+
cp -rfp ./web-twain-docs-preview/* ./DWTDocPreview/
53+
cd Docs-Template-Repo && git pull && cd .. && cp -rfp ./Docs-Template-Repo/* ./DWTDocPreview/
54+
sed -i -e "1,3s/blob\/master$/blob\/preview/" \
55+
-e "1,3s/blob\/main$/blob\/preview/" /home/ubuntu/DWTDocPreview/_config.yml
56+
cd DWTDocPreview && bundle exec jekyll build
57+
- name: Sync files to Test Env
58+
uses: SamKirkland/FTP-Deploy-Action@4.3.0
59+
with:
60+
server: ${{ secrets.FTP_TEST_SITE_SERVER }}
61+
username: ${{ secrets.FTP_TEST_SITE_USER }}
62+
password: ${{ secrets.FTP_TEST_SITE_PASSWORD }}
63+
port: 7500
64+
local-dir: /home/ubuntu/DWTDocPreview/_site/
65+
server-dir: /www.dynamsoft.com/web-twain/docs/
66+

0 commit comments

Comments
 (0)