diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 79e19b1..b3717b9 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -18,16 +18,77 @@ jobs: # This workflow contains jobs called "Build-Master" and "Build-Preview" Build-Main: if: ${{ github.ref == 'refs/heads/master' }} - uses: dynamsoft-docs/Docs-Template-Repo/.github/workflows/called-workflow-build-sync-production.yml@main - with: - doc-repo: label-recognition-docs - doc-url: label-recognition/docs/core - secrets: inherit + # The type of runner that the job will run on + runs-on: self-hosted + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + #- uses: actions/checkout@v2 + + # Runs a set of commands using the runners shell + - name: Run a multi-line script + run: | + cd /home/ubuntu + [ -d DLRDocCore ] && rm -rf DLRDocCore + [ -d label-recognition-docs ] && rm -rf label-recognition-docs + [ -d Docs-Template-Repo-Preview ] && rm -rf Docs-Template-Repo-Preview + [ ! -d DLRDocCore ] && mkdir -p DLRDocCore + git clone --depth 1 https://github.com/dynamsoft-docs/label-recognition-docs.git label-recognition-docs + git clone --depth 1 --branch preview https://github.com/dynamsoft-docs/Docs-Template-Repo.git Docs-Template-Repo-Preview + cp -rfp ./label-recognition-docs/* ./DLRDocCore/ + cp -rfp ./Docs-Template-Repo-Preview/* ./DLRDocCore/ + cd DLRDocCore && bundle install && bundle exec jekyll build + + - name: Sync files - Main Site + uses: SamKirkland/FTP-Deploy-Action@4.3.0 + with: + server: ${{ secrets.FTP_DYNAMSOFT_LOCAL_SERVER }} + username: ${{ secrets.FTP_DYNAMSOFT_LOCAL_USER }} + password: ${{ secrets.FTP_DYNAMSOFT_LOCAL_PASSWORD }} + port: 21 + local-dir: /home/ubuntu/DLRDocCore/_site/ + server-dir: /www.dynamsoft.com/label-recognition/docs/core/ + + - name: Trigger Webhook + run: | + curl -X POST -H "${{ secrets.WEBHOOK_USER }}" -H "${{ secrets.WEBHOOK_TOKEN }}" -H "Content-Type: application/json" -d "[\"/label-recognition/docs/core/*\"]" ${{ secrets.WEBHOOK_URL }} + Build-Preview: if: ${{ github.ref == 'refs/heads/preview' }} - uses: dynamsoft-docs/Docs-Template-Repo/.github/workflows/called-workflow-build-sync-testing.yml@preview - with: - doc-repo: label-recognition-docs - doc-url: label-recognition/docs/core - secrets: inherit + # The type of runner that the job will run on + runs-on: self-hosted + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Runs a set of commands using the runners shell + - name: clear space + run: | + cd /home/ubuntu + [ -d DLRDocCorePreview ] && rm -rf DLRDocCorePreview + [ -d label-recognition-docs-core-preview ] && rm -rf label-recognition-docs-core-preview + [ -d Docs-Template-Repo-Preview ] && rm -rf Docs-Template-Repo-Preview + cd /home/ubuntu + + - name: Build the site + run: | + cd /home/ubuntu + [ ! -d DLRDocCorePreview ] && mkdir -p DLRDocCorePreview + git clone --depth 1 --branch preview https://github.com/Dynamsoft-Docs/label-recognition-docs.git label-recognition-docs-core-preview + git clone --depth 1 --branch preview https://github.com/dynamsoft-docs/Docs-Template-Repo.git Docs-Template-Repo-Preview + cp -rfp ./label-recognition-docs-core-preview/* ./DLRDocCorePreview/ + cp -rfp ./Docs-Template-Repo-Preview/* ./DLRDocCorePreview/ + sed -i -e "1,3s/blob\/master$/blob\/preview/" \ + -e "1,3s/blob\/main$/blob\/preview/" /home/ubuntu/DLRDocCorePreview/_config.yml + cd DLRDocCorePreview && bundle install && bundle exec jekyll build + + - name: Sync files + uses: SamKirkland/FTP-Deploy-Action@4.3.0 + with: + server: ${{ secrets.FTP_TEST_SITE_SERVER }} + username: ${{ secrets.FTP_TEST_SITE_USER }} + password: ${{ secrets.FTP_TEST_SITE_PASSWORD }} + port: 7500 + local-dir: /home/ubuntu/DLRDocCorePreview/_site/ + server-dir: /www.dynamsoft.com/label-recognition/docs/core/ diff --git a/_config.yml b/_config.yml index ccc7317..0ba2f4c 100644 --- a/_config.yml +++ b/_config.yml @@ -67,6 +67,11 @@ baseurl: "/label-recognition/docs/core" plugins: - jemoji - jekyll-sitemap + - jekyll-webp + - jekyll-relative-links + - jekyll-redirect-from + - jekyll-readme-index + - jekyll-seo-tag defaults: diff --git a/_includes/dlrNav.html b/_includes/dlrNav.html index cddcd61..70fefe3 100644 --- a/_includes/dlrNav.html +++ b/_includes/dlrNav.html @@ -1,17 +1,15 @@