Skip to content

DDLS Documentation Preview #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions .github/workflows/called-workflow-build-sync-production.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Build-Sync-Main

# the workflow will be called by others
on:
workflow_call:
inputs:
doc-repo:
required: true
type: string
doc-url:
required: true
type: string

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:

Build-And-Sync-To-Production:
# The type of runner that the job will run on
runs-on: [self-hosted, doc-build]
env:
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
# 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: Build the full site - main
run: |
cd ${{ runner.temp }}
mkdir -p DocHome
git clone --depth 1 https://github.com/dynamsoft-docs/${{ inputs.doc-repo }}.git ${{ inputs.doc-repo }}
git clone --depth 1 https://github.com/dynamsoft-docs/Docs-Template-Repo.git Docs-Template-Repo
cp -rfp ./${{ inputs.doc-repo }}/* ./DocHome/
cp -rfp ./Docs-Template-Repo/* ./DocHome/
cd DocHome && bundle install && bundle exec jekyll build
# cd DocHome && bundle exec jekyll build

- name: Sync files
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: ${{ runner.temp }}/DocHome/_site/
server-dir: /www.dynamsoft.com/${{ inputs.doc-url }}/

- name: Trigger Webhook
run: |
curl -X POST -H "${{ secrets.WEBHOOK_USER }}" -H "${{ secrets.WEBHOOK_TOKEN }}" -H "Content-Type: application/json" -d "[\"/${{ inputs.doc-url }}/*\"]" ${{ secrets.WEBHOOK_URL }}

- name: Update Sitemap
if: startsWith(inputs.doc-url, 'barcode-reader') ||
startsWith(inputs.doc-url, 'capture-vision') ||
startsWith(inputs.doc-url, 'label-recognition') ||
startsWith(inputs.doc-url, 'document-normalizer') ||
startsWith(inputs.doc-url, 'code-parser') ||
startsWith(inputs.doc-url, 'camera-enhancer')
run: |
cd ${{ runner.temp }}/DocHome/assets/scripts/GenerateSitemap
python3 GenerateSitemapByMenuTree.py --product dcv,dbr
curl -T ${{ runner.temp }}/DocHome/assets/scripts/GenerateSitemap/barcode-reader/docs/menu-tree-sitemap.xml ftp://${{ secrets.FTP_DYNAMSOFT_LOCAL_SERVER }}/www.dynamsoft.com/barcode-reader/docs/ --user ${{ secrets.FTP_DYNAMSOFT_LOCAL_USER }}:${{ secrets.FTP_DYNAMSOFT_LOCAL_PASSWORD }}
curl -T ${{ runner.temp }}/DocHome/assets/scripts/GenerateSitemap/capture-vision/docs/menu-tree-sitemap.xml ftp://${{ secrets.FTP_DYNAMSOFT_LOCAL_SERVER }}/www.dynamsoft.com/capture-vision/docs/ --user ${{ secrets.FTP_DYNAMSOFT_LOCAL_USER }}:${{ secrets.FTP_DYNAMSOFT_LOCAL_PASSWORD }}
73 changes: 73 additions & 0 deletions .github/workflows/called-workflow-build-sync-testing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Build-Sync-Preview

# the workflow will be called by others
on:
workflow_call:
inputs:
doc-repo:
required: true
type: string
doc-url:
required: true
type: string

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
Build-Site-Preview:
# The type of runner that the job will run on
runs-on: [self-hosted, doc-build]

# 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: Build the full site with preview branch
run: |
cd ${{ runner.temp }}
mkdir -p DocHome
git clone --depth 1 --branch preview https://github.com/dynamsoft-docs/${{ inputs.doc-repo }}.git ${{ inputs.doc-repo }}
git clone --depth 1 --branch preview https://github.com/dynamsoft-docs/Docs-Template-Repo.git Docs-Template-Repo
cp -rfp ./${{ inputs.doc-repo }}/* ./DocHome/
cp -rfp ./Docs-Template-Repo/* ./DocHome/
sed -i -e "1,3s/blob\/master$/blob\/preview/" \
-e "1,3s/blob\/main$/blob\/preview/" ${{ runner.temp }}/DocHome/_config.yml
cd DocHome && bundle install && bundle exec jekyll build

- name: "Create Tar files"
run: tar -czvf ${{ inputs.doc-repo }}.tar.gz -C ${{ runner.temp }}/DocHome/_site .

- name: Upload the built site as a single artifact
uses: actions/upload-artifact@v4.6.2
with:
name: ${{ inputs.doc-repo }}
path: ${{ inputs.doc-repo }}.tar.gz
retention-days: 2

Sync-To-Testing:
# The type of runner that the job will run on
runs-on: [self-hosted, upload-test]
needs: Build-Site-Preview

# 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: Download the artifact
uses: actions/download-artifact@v4.3.0
with:
name: ${{ inputs.doc-repo }}

- name: "Extract Tar files"
shell: cmd
run: |
mkdir ${{ runner.temp }}\DocHome\_site
tar -xzf ${{ inputs.doc-repo }}.tar.gz -C ${{ runner.temp }}\DocHome\_site

- name: Sync files
uses: SamKirkland/FTP-Deploy-Action@v4.3.5
with:
server: ${{ secrets.FTP_TEST_SITE_SERVER }}
username: ${{ secrets.FTP_TEST_SITE_USER }}
password: ${{ secrets.FTP_TEST_SITE_PASSWORD }}
protocol: ftps
port: ${{ secrets.FTP_TEST_SITE_PORT }}
local-dir: ${{ runner.temp }}\DocHome\_site/
server-dir: /www.dynamsoft.com/${{ inputs.doc-url }}/
33 changes: 33 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# This is a basic workflow to help you get started with Actions

name: CI

# Controls when the workflow will run
on:
# Triggers the workflow on push events to main and preview
push:
branches:
- main
- preview

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains jobs called "Build-Main" and "Build-Preview"
Build-Main:
if: ${{ github.ref == 'refs/heads/main' }}
uses: dynamsoft-docs/Docs-Template-Repo/.github/workflows/called-workflow-build-sync-production.yml@main
with:
doc-repo: driver-license-scanner-docs-js
doc-url: driver-license-scanner/docs
secrets: inherit

Build-Preview:
if: ${{ github.ref == 'refs/heads/preview' }}
uses: ./.github/workflows/called-workflow-build-sync-testing.yml
with:
doc-repo: driver-license-scanner-docs-js
doc-url: driver-license-scanner/docs/web/
secrets: inherit
41 changes: 41 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Layout templates
_layouts/**

# Assets
assets/font-face/**
assets/img-icon/**
assets/js/**
assets/scripts/**
assets/css/**

# Web resources
webres/**

# Includes
_includes/productNav/*
!_/includes/productNav/driver-license-scannerNav.html
_includes/auto-version-list.html
_includes/head.html
_includes/liquid_autoGenerateHistoryList.html
_includes/liquid_breadcrumb.html
_includes/liquid_generateFullTree.html
_includes/liquid_searchVersionTreeFile.html
_includes/livehelp.html
_includes/main-page-head.html
_includes/page_footer.html
_includes/page_header.html
_includes/productNav_OLD.html
_includes/productNav.html
_includes/search-input.html
_includes/trialLicense.html

# Plugins
_plugins/**

# Site resources
_site/**

sitemap.xml
Hide_Tree_Page.md
Gemfile.lock
Gemfile
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
# driver-license-scanner-docs-js
WIP
42 changes: 42 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
repository: dynamsoft-docs/driver-license-scanner-docs-js
repositoryUrl: https://github.com/dynamsoft-docs/driver-license-scanner-docs-js/blob/main
docFullPath: https://www.dynamsoft.com/driver-license-scanner/docs/web
firstLevelUrl: /driver-license-scanner/docs/web
docHomePage: /driver-license-scanner/docs/web/introduction/index.html
product-page-url: https://www.dynamsoft.com/driver-license-scanner

product-name: /driver-license-scanner-js/
product-title: Dynamsoft Driver License Scanner JavaScript Edition

introduction: /driver-license-scanner/docs/web/introduction/
code-gallery: /driver-license-scanner/docs/web/code-gallery/
api: /driver-license-scanner/docs/web/api/
guides: /driver-license-scanner/docs/web/guides/
release-notes: /driver-license-scanner/docs/web/release-notes/

useVersionTree: true

assets: /driver-license-scanner/docs/web/assets/
edit_icon: /driver-license-scanner/docs/web/assets/img-icon/edit-icon.png
smile_icon: /driver-license-scanner/docs/web/assets/img-icon/icon-smile.png
sad_icon: /driver-license-scanner/docs/web/assets/img-icon/icon-sad.png
download: /driver-license-scanner/downloads/

plugins:
- jekyll-sitemap

defaults:
- scope:
path: ""
values:
layout: "default-layout"
noTitleIndex: true
needAutoGenerateSidebar: true
needGenerateH3Content: true
- scope:
path: "Hide_Tree_Page.html"
values:
sitemap: false

url: https://www.dynamsoft.com # sitemap root
baseurl: /driver-license-scanner/docs/web
6 changes: 6 additions & 0 deletions _data/full_tree.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
tree_file_list:
- sidelist-introduction.html
- sidelist-guides.html
- sidelist-api.html
- sidelist-release-notes.html
- sidelist-full-tree.html
4 changes: 4 additions & 0 deletions _data/product_version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
useGroupedVersion: true

version_info_list:
- value: latest version (X.y)
2 changes: 2 additions & 0 deletions _includes/sidelist-api.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<li><a href="{{ site.api }}index.html" class="otherLinkColour">API References</a>
</li>
4 changes: 4 additions & 0 deletions _includes/sidelist-full-tree.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{%- include liquid_searchVersionTreeFile.html ver=include.ver curPath=include.curPath targetRelativePath="sidelist-introduction.html" -%}
{%- include liquid_searchVersionTreeFile.html ver=include.ver curPath=include.curPath targetRelativePath="sidelist-guides.html" -%}
{%- include liquid_searchVersionTreeFile.html ver=include.ver curPath=include.curPath targetRelativePath="sidelist-api.html" -%}
{%- include liquid_searchVersionTreeFile.html ver=include.ver curPath=include.curPath targetRelativePath="sidelist-release-notes.html" -%}
7 changes: 7 additions & 0 deletions _includes/sidelist-guides.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<li>
<a class="otherLinkColour">Developer Guides</a>
<ul>
<li><a href="{{ site.guides }}index.html" class="otherLinkColour">Driver License Scanner User Guide</a></li>
<li><a href="{{ site.guides }}customize.html" class="otherLinkColour">Customize your Driver License Scanner</a></li>
</ul>
</li>
2 changes: 2 additions & 0 deletions _includes/sidelist-introduction.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<li><a href="{{ site.introduction }}index.html" class="otherLinkColour">Introduction</a>
</li>
2 changes: 2 additions & 0 deletions _includes/sidelist-release-notes.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<li><a href="{{ site.releasenotes }}index.html" class="otherLinkColour">Release Notes</a>
</li>
Loading