|
8 | 8 | push: |
9 | 9 | branches: |
10 | 10 | - main |
11 | | - - preview |
| 11 | + #- preview |
12 | 12 |
|
13 | 13 | # Allows you to run this workflow manually from the Actions tab |
14 | 14 | workflow_dispatch: |
15 | 15 |
|
16 | 16 | # A workflow run is made up of one or more jobs that can run sequentially or in parallel |
17 | 17 | jobs: |
18 | 18 | # This workflow contains jobs called "Build-main" and "Build-Preview" |
19 | | - Build-main: |
| 19 | + Build-Main: |
20 | 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 install && 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/DCPDocJS/_site/ |
56 | | - server-dir: /www.dynamsoft.com/code-parser/docs/web/ |
57 | | - |
58 | | - - name: Trigger Webhook |
59 | | - run: | |
60 | | - curl -X POST -H "${{ secrets.WEBHOOK_USER }}" -H "${{ secrets.WEBHOOK_TOKEN }}" -H "Content-Type: application/json" -d "[\"/code-parser/docs/web/*\"]" ${{ secrets.WEBHOOK_URL }} |
61 | | -
|
| 21 | + uses: dynamsoft-docs/Docs-Template-Repo/.github/workflows/called-workflow-build-sync-production.yml@main |
| 22 | + with: |
| 23 | + doc-repo: code-parser-docs-js |
| 24 | + doc-url: code-parser/docs/web |
| 25 | + secrets: inherit |
62 | 26 |
|
63 | 27 | Build-Preview: |
64 | 28 | if: ${{ github.ref == 'refs/heads/preview' }} |
65 | | - # The type of runner that the job will run on |
66 | | - runs-on: self-hosted |
67 | | - |
68 | | - # Steps represent a sequence of tasks that will be executed as part of the job |
69 | | - steps: |
70 | | - # Runs a set of commands using the runners shell |
71 | | - - name: clear space |
72 | | - run: | |
73 | | - cd /home/ubuntu |
74 | | - [ -d DCPDocJSPreview ] && rm -rf DCPDocJSPreview |
75 | | - [ -d code-parser-docs-js-preview ] && rm -rf code-parser-docs-js-preview |
76 | | - [ -d Docs-Template-Repo-Preview ] && rm -rf Docs-Template-Repo-Preview |
77 | | - cd /home/ubuntu |
78 | | -
|
79 | | - - name: Build the site |
80 | | - run: | |
81 | | - cd /home/ubuntu |
82 | | - mkdir -p DCPDocJSPreview |
83 | | - 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 |
84 | | - git clone --depth 1 --branch preview https://github.com/dynamsoft-docs/Docs-Template-Repo.git Docs-Template-Repo-Preview |
85 | | - cp -rfp ./code-parser-docs-js-preview/* ./DCPDocJSPreview/ |
86 | | - cp -rfp ./Docs-Template-Repo-Preview/* ./DCPDocJSPreview/ |
87 | | - sed -i -e "1,3s/blob\/master$/blob\/preview/" \ |
88 | | - -e "1,3s/blob\/main$/blob\/preview/" /home/ubuntu/DCPDocJSPreview/_config.yml |
89 | | - cd DCPDocJSPreview && bundle install && bundle exec jekyll build |
| 29 | + uses: dynamsoft-docs/Docs-Template-Repo/.github/workflows/called-workflow-build-sync-testing.yml@preview |
| 30 | + with: |
| 31 | + doc-repo: code-parser-docs-js |
| 32 | + doc-url: code-parser/docs/web |
| 33 | + secrets: inherit |
90 | 34 |
|
91 | | - - name: Sync files |
92 | | - uses: SamKirkland/FTP-Deploy-Action@4.3.0 |
93 | | - with: |
94 | | - server: ${{ secrets.FTP_TEST_SITE_SERVER }} |
95 | | - username: ${{ secrets.FTP_TEST_SITE_USER }} |
96 | | - password: ${{ secrets.FTP_TEST_SITE_PASSWORD }} |
97 | | - port: 7500 |
98 | | - local-dir: /home/ubuntu/DCPDocJSPreview/_site/ |
99 | | - server-dir: /www.dynamsoft.com/code-parser/docs/web/ |
0 commit comments