1010# A workflow run is made up of one or more jobs that can run sequentially or in parallel
1111jobs :
1212 # This workflow contains a single job called "build"
13- Build-Master :
14- if : ${{ github.ref == 'refs/heads/master ' }}
13+ Build-v18-4 :
14+ if : ${{ github.ref == 'refs/heads/18.5.1 ' }}
1515 # The type of runner that the job will run on
1616 runs-on : [self-hosted, doc-build]
1717
@@ -21,12 +21,12 @@ jobs:
2121 - name : Build the full site - main
2222 run : |
2323 cd ${{ runner.temp }}
24- mkdir -p DocHome
25- git clone --depth 1 https://${{ secrets.GIT_USER }}:${{ secrets.GIT_PAT }}@github.com/dynamsoft-docs/web-twain-docs.git web-twain-docs
26- git clone --depth 1 https://github.com/dynamsoft-docs/Docs-Template-Repo.git Docs-Template-Repo
27- cp -rfp ./web-twain-docs/* ./DocHome /
28- cp -rfp ./Docs-Template-Repo/* ./DocHome /
29- cd DocHome && bundle install && bundle exec jekyll build
24+ mkdir -p DWTDocArchive
25+ git clone --depth 1 --branch v18.5.1 https://${{ secrets.GIT_USER }}:${{ secrets.GIT_PAT }}@github.com/dynamsoft-docs/web-twain-docs.git web-twain-docs-archive
26+ git clone --depth 1 --branch dwt-v18.5.1 https://github.com/dynamsoft-docs/Docs-Template-Repo.git Docs-Template-Repo-archive
27+ cp -rfp ./web-twain-docs-archive /* ./DWTDocArchive /
28+ cp -rfp ./Docs-Template-Repo-archive /* ./DWTDocArchive /
29+ cd DWTDocArchive && bundle install && bundle exec jekyll build
3030
3131 - name : Sync files
3232 uses :
SamKirkland/[email protected] 3535 username : ${{ secrets.FTP_DYNAMSOFT_LOCAL_USER }}
3636 password : ${{ secrets.FTP_DYNAMSOFT_LOCAL_PASSWORD }}
3737 port : 21
38- local-dir : ${{ runner.temp }}/DocHome /_site/
39- server-dir : /www.dynamsoft.com/web-twain/docs/
38+ local-dir : ${{ runner.temp }}/DWTDocArchive /_site/
39+ server-dir : /www.dynamsoft.com/web-twain/docs-archive/v18.5.1 /
4040
4141 - name : Trigger Webhook
4242 run : |
43- curl -X POST -H "${{ secrets.WEBHOOK_USER }}" -H "${{ secrets.WEBHOOK_TOKEN }}" -H "Content-Type: application/json" -d "[\"/web-twain/docs/*\"]" ${{ secrets.WEBHOOK_URL }}
44-
45-
46- Build-Site-Preview :
47- if : ${{ github.ref == 'refs/heads/preview' }}
48- # The type of runner that the job will run on
49- runs-on : [self-hosted, doc-build]
50-
51- # Steps represent a sequence of tasks that will be executed as part of the job
52- steps :
53- # Runs a set of commands using the runners shell
54- - name : Build the full site with preview branch
55- run : |
56- cd ${{ runner.temp }}
57- mkdir -p DocHome
58- git clone --depth 1 --branch preview https://${{ secrets.GIT_USER }}:${{ secrets.GIT_PAT }}@github.com/dynamsoft-docs/web-twain-docs.git web-twain-docs
59- git clone --depth 1 --branch preview https://github.com/dynamsoft-docs/Docs-Template-Repo.git Docs-Template-Repo
60- cp -rfp ./web-twain-docs/* ./DocHome/
61- cp -rfp ./Docs-Template-Repo/* ./DocHome/
62- sed -i -e "1,3s/blob\/master$/blob\/preview/" \
63- -e "1,3s/blob\/main$/blob\/preview/" ${{ runner.temp }}/DocHome/_config.yml
64- cd DocHome && bundle install && bundle exec jekyll build
65-
66- - name : ' Create Tar files'
67- run : tar -czvf web-twain-docs.tar.gz -C ${{ runner.temp }}/DocHome/_site .
68-
69- - name : Upload the built site as a single artifact
70- uses : actions/upload-artifact@v3
71- with :
72- name : web-twain-docs
73- path : web-twain-docs.tar.gz
74- retention-days : 2
75-
76- Sync-To-Testing :
77- # The type of runner that the job will run on
78- runs-on : [self-hosted, upload-test]
79- needs : Build-Site-Preview
80-
81- # Steps represent a sequence of tasks that will be executed as part of the job
82- steps :
83- # Runs a set of commands using the runners shell
84- - name : Download the artifact
85- uses : actions/download-artifact@v3
86- with :
87- name : web-twain-docs
88-
89- - name : ' Extract Tar files'
90- shell : cmd
91- run : |
92- mkdir ${{ runner.temp }}\DocHome\_site
93- tar -xzf web-twain-docs.tar.gz -C ${{ runner.temp }}\DocHome\_site
94-
95- - name : Sync files
96- uses :
SamKirkland/[email protected] 97- with :
98- server : ${{ secrets.FTP_TEST_SITE_SERVER }}
99- username : ${{ secrets.FTP_TEST_SITE_USER }}
100- password : ${{ secrets.FTP_TEST_SITE_PASSWORD }}
101- port : 7500
102- local-dir : ${{ runner.temp }}\DocHome\_site/
103- server-dir : /www.dynamsoft.com/web-twain/docs/
104-
43+ curl -X POST -H "${{ secrets.WEBHOOK_USER }}" -H "${{ secrets.WEBHOOK_TOKEN }}" -H "Content-Type: application/json" -d "[\"/web-twain/docs/*\"]" ${{ secrets.WEBHOOK_URL }}
0 commit comments