|
9 | 9 |
|
10 | 10 | # A workflow run is made up of one or more jobs that can run sequentially or in parallel |
11 | 11 | jobs: |
12 | | - # This workflow contains jobs called "Build-Master" and "Build-Preview" |
13 | | - Build-Master: |
14 | | - if: ${{ github.ref == 'refs/heads/master' }} |
| 12 | + Build-v18-1: |
| 13 | + if: ${{ github.ref == 'refs/heads/v18.1' }} |
15 | 14 | # The type of runner that the job will run on |
16 | 15 | runs-on: self-hosted |
17 | 16 |
|
18 | 17 | # Steps represent a sequence of tasks that will be executed as part of the job |
19 | 18 | 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 | | - [ -d Docs-Template-Repo-Preview ] && rm -rf Docs-Template-Repo-Preview |
30 | | - mkdir -p DWTDoc |
31 | | - git clone --depth 1 https://github.com/dynamsoft-docs/web-twain-docs.git web-twain-docs |
32 | | - git clone --depth 1 --branch preview https://github.com/dynamsoft-docs/Docs-Template-Repo.git Docs-Template-Repo-Preview |
33 | | - cp -rfp ./web-twain-docs/* ./DWTDoc/ |
34 | | - cd Docs-Template-Repo-Preview && git pull && cd .. && cp -rfp ./Docs-Template-Repo-Preview/* ./DWTDoc/ |
35 | | - cd DWTDoc && bundle exec jekyll build |
36 | | - python3 /home/ubuntu/ftp.py /home/ubuntu/DWTDoc/_site/ ./www.dynamsoft.com/web-twain/docs/ prod |
37 | | - |
38 | | - Build-Preview: |
39 | | - if: ${{ github.ref == 'refs/heads/preview' }} |
40 | | - # The type of runner that the job will run on |
41 | | - runs-on: self-hosted |
42 | | - |
43 | | - # Steps represent a sequence of tasks that will be executed as part of the job |
44 | | - steps: |
45 | | - |
46 | 19 | # Runs a set of commands using the runners shell |
47 | 20 | - name: Build the site |
48 | 21 | run: | |
49 | 22 | cd /home/ubuntu |
50 | | - [ -d DWTDocPreview ] && rm -rf DWTDocPreview |
51 | | - [ -d web-twain-docs-preview ] && rm -rf web-twain-docs-preview |
52 | | - [ -d Docs-Template-Repo-Preview ] && rm -rf Docs-Template-Repo-Preview |
53 | | - mkdir -p DWTDocPreview |
54 | | - git clone --depth 1 --branch preview https://github.com/dynamsoft-docs/web-twain-docs.git web-twain-docs-preview |
55 | | - git clone --depth 1 --branch preview https://github.com/dynamsoft-docs/Docs-Template-Repo.git Docs-Template-Repo-Preview |
56 | | - cp -rfp ./web-twain-docs-preview/* ./DWTDocPreview/ |
57 | | - cp -rfp ./Docs-Template-Repo-Preview/* ./DWTDocPreview/ |
58 | | - sed -i -e "1,3s/blob\/master$/blob\/preview/" \ |
59 | | - -e "1,3s/blob\/main$/blob\/preview/" /home/ubuntu/DWTDocPreview/_config.yml |
60 | | - cd DWTDocPreview && bundle exec jekyll build |
61 | | - - name: Sync files to Test Env |
| 23 | + [ -d web-twain-docs-archive ] && rm -rf web-twain-docs-archive |
| 24 | + [ -d Docs-Template-Repo-archive ] && rm -rf Docs-Template-Repo-archive |
| 25 | + [ -d DWTDocArchive ] && rm -rf DWTDocArchive |
| 26 | + mkdir -p DWTDocArchive |
| 27 | + git clone --depth 1 --branch v18.1 https://github.com/Dynamsoft/web-twain-docs.git web-twain-docs-archive |
| 28 | + git clone --depth 1 --branch dwt-v18.1 https://github.com/dynamsoft-docs/Docs-Template-Repo.git Docs-Template-Repo-archive |
| 29 | + cp -rfp ./web-twain-docs-archive/* ./DWTDocArchive/ |
| 30 | + cp -rfp ./Docs-Template-Repo-archive/* ./DWTDocArchive/ |
| 31 | + sed -i -e "1,3s/blob\/master$/blob\/v18.1/" \ |
| 32 | + -e "1,3s/blob\/main$/blob\/v18.1/" /home/ubuntu/DWTDocArchive/_config.yml |
| 33 | + cd DWTDocArchive && bundle exec jekyll build |
| 34 | + |
| 35 | + - name: Sync files |
62 | 36 | uses: SamKirkland/FTP-Deploy-Action@4.3.0 |
63 | 37 | with: |
64 | | - server: ${{ secrets.FTP_TEST_SITE_SERVER }} |
65 | | - username: ${{ secrets.FTP_TEST_SITE_USER }} |
66 | | - password: ${{ secrets.FTP_TEST_SITE_PASSWORD }} |
67 | | - port: 7500 |
68 | | - local-dir: /home/ubuntu/DWTDocPreview/_site/ |
69 | | - server-dir: /www.dynamsoft.com/web-twain/docs/ |
| 38 | + server: ${{ secrets.FTP_DYNAMSOFT_LOCAL_SERVER }} |
| 39 | + username: ${{ secrets.FTP_DYNAMSOFT_LOCAL_USER }} |
| 40 | + password: ${{ secrets.FTP_DYNAMSOFT_LOCAL_PASSWORD }} |
| 41 | + port: 21 |
| 42 | + local-dir: /home/ubuntu/DWTDocArchive/_site/ |
| 43 | + server-dir: /www.dynamsoft.com/web-twain/docs-archive/v18.1/ |
| 44 | + |
| 45 | + - name: Clear files |
| 46 | + run: | |
| 47 | + cd /home/ubuntu |
| 48 | + [ -d web-twain-docs-archive ] && rm -rf web-twain-docs-archive |
| 49 | + [ -d Docs-Template-Repo-archive ] && rm -rf Docs-Template-Repo-archive |
| 50 | + [ -d DWTDocArchive ] && rm -rf DWTDocArchive |
70 | 51 | |
0 commit comments