Skip to content

Commit 9ad6946

Browse files
add build
1 parent 8bba0b1 commit 9ad6946

File tree

1 file changed

+94
-0
lines changed

1 file changed

+94
-0
lines changed

.github/workflows/main.yml

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# This is a basic workflow to help you get started with Actions
2+
3+
name: CI
4+
5+
# Controls when the workflow will run
6+
on:
7+
# Triggers the workflow on push events but only for the main branch
8+
push:
9+
branches:
10+
# - main
11+
- preview
12+
13+
# Allows you to run this workflow manually from the Actions tab
14+
workflow_dispatch:
15+
16+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
17+
jobs:
18+
# This workflow contains jobs called "Build-main" and "Build-Preview"
19+
Build-main:
20+
if: ${{ github.ref == 'refs/heads/main' }}
21+
# The type of runner that the job will run on
22+
runs-on: self-hosted
23+
24+
# Steps represent a sequence of tasks that will be executed as part of the job
25+
steps:
26+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
27+
#- uses: actions/checkout@v2
28+
29+
# Runs a set of commands using the runners shell
30+
- name: clear space
31+
run: |
32+
cd /home/ubuntu
33+
[ -d DCPDocJS ] && rm -rf DCPDocJS
34+
[ -d code-parser-docs-js ] && rm -rf code-parser-docs-js
35+
[ -d Docs-Template-Repo-Preview ] && rm -rf Docs-Template-Repo-Preview
36+
cd /home/ubuntu
37+
38+
- name: Build the site
39+
run: |
40+
cd /home/ubuntu
41+
mkdir -p DCPDocJS
42+
git clone --depth 1 https://github.com/dynamsoft-docs/code-parser-docs-js.git code-parser-docs-js
43+
git clone --depth 1 --branch preview https://github.com/dynamsoft-docs/Docs-Template-Repo.git Docs-Template-Repo-Preview
44+
cp -rfp ./code-parser-docs-js/* ./DCPDocJS/
45+
cp -rfp ./Docs-Template-Repo-Preview/* ./DCPDocJS/
46+
cd DCPDocJS && bundle exec jekyll build
47+
48+
- name: Sync files
49+
uses: SamKirkland/FTP-Deploy-Action@4.3.0
50+
with:
51+
server: ${{ secrets.FTP_DYNAMSOFT_LOCAL_SERVER }}
52+
username: ${{ secrets.FTP_DYNAMSOFT_LOCAL_USER }}
53+
password: ${{ secrets.FTP_DYNAMSOFT_LOCAL_PASSWORD }}
54+
port: 21
55+
local-dir: /home/ubuntu/DDNDocServer/_site/
56+
server-dir: /www.dynamsoft.com/code-parser/docs/js/
57+
58+
Build-Preview:
59+
if: ${{ github.ref == 'refs/heads/preview' }}
60+
# The type of runner that the job will run on
61+
runs-on: self-hosted
62+
63+
# Steps represent a sequence of tasks that will be executed as part of the job
64+
steps:
65+
# Runs a set of commands using the runners shell
66+
- name: clear space
67+
run: |
68+
cd /home/ubuntu
69+
[ -d DCPDocJSPreview ] && rm -rf DCPDocJSPreview
70+
[ -d code-parser-docs-js-preview ] && rm -rf code-parser-docs-js-preview
71+
[ -d Docs-Template-Repo-Preview ] && rm -rf Docs-Template-Repo-Preview
72+
cd /home/ubuntu
73+
74+
- name: Build the site
75+
run: |
76+
cd /home/ubuntu
77+
mkdir -p DCPDocJSPreview
78+
git clone --depth 1 --branch preview https://${{ secrets.GIT_USER }}:${{ secrets.GIT_PAT }}@github.com/dynamsoft-docs/code-parser-docs-js.git code-parser-docs-js-preview
79+
git clone --depth 1 --branch preview https://github.com/dynamsoft-docs/Docs-Template-Repo.git Docs-Template-Repo-Preview
80+
cp -rfp ./code-parser-docs-js-preview/* ./DCPDocJSPreview/
81+
cp -rfp ./Docs-Template-Repo-Preview/* ./DCPDocJSPreview/
82+
sed -i -e "1,3s/blob\/master$/blob\/preview/" \
83+
-e "1,3s/blob\/main$/blob\/preview/" /home/ubuntu/DCPDocJSPreview/_config.yml
84+
cd DCPDocJSPreview && bundle exec jekyll build
85+
86+
- name: Sync files
87+
uses: SamKirkland/FTP-Deploy-Action@4.3.0
88+
with:
89+
server: ${{ secrets.FTP_TEST_SITE_SERVER }}
90+
username: ${{ secrets.FTP_TEST_SITE_USER }}
91+
password: ${{ secrets.FTP_TEST_SITE_PASSWORD }}
92+
port: 7500
93+
local-dir: /home/ubuntu/DCPDocJSPreview/_site/
94+
server-dir: /www.dynamsoft.com/code-parser/docs/js/

0 commit comments

Comments
 (0)