Skip to content

update guide & upgrade #104

update guide & upgrade

update guide & upgrade #104

Workflow file for this run

# 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 but only for the main branch
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-Master" and "Build-Preview"
Build-Master:
if: ${{ github.ref == 'refs/heads/main' }}
# 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 DLRDocServer ] && rm -rf DLRDocServer
[ -d label-recognition-docs-server ] && rm -rf label-recognition-docs-server
[ -d Docs-Template-Repo ] && rm -rf Docs-Template-Repo
[ ! -d DLRDocServer ] && mkdir -p DLRDocServer
git clone --depth 1 https://github.com/Dynamsoft-Docs/label-recognition-docs-server.git label-recognition-docs-server
git clone --depth 1 --branch preview https://github.com/dynamsoft-docs/Docs-Template-Repo.git Docs-Template-Repo
cp -rfp ./label-recognition-docs-server/* ./DLRDocServer/
cp -rfp ./Docs-Template-Repo/* ./DLRDocServer/
cd DLRDocServer && 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/DLRDocServer/_site/
server-dir: /www.dynamsoft.com/label-recognition/docs/server/
- name: Trigger Webhook
run: |
curl -X POST -H "${{ secrets.WEBHOOK_USER }}" -H "${{ secrets.WEBHOOK_TOKEN }}" -H "Content-Type: application/json" -d "[\"/label-recognition/docs/server/*\"]" ${{ secrets.WEBHOOK_URL }}
Build-Preview:
if: ${{ github.ref == 'refs/heads/preview' }}
# 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 DLRDocServerPreview ] && rm -rf DLRDocServerPreview
[ -d label-recognition-docs-server-preview ] && rm -rf label-recognition-docs-server-preview
[ -d Docs-Template-Repo-Preview-DCV2 ] && rm -rf Docs-Template-Repo-Preview-DCV2
cd /home/ubuntu
- name: Build the site
run: |
cd /home/ubuntu
[ ! -d DLRDocServerPreview ] && mkdir -p DLRDocServerPreview
git clone --depth 1 --branch preview https://${{ secrets.GIT_USER }}:${{ secrets.GIT_PAT }}@github.com/dynamsoft-docs/label-recognition-docs-server.git label-recognition-docs-server-preview
git clone --depth 1 --branch preview https://github.com/dynamsoft-docs/Docs-Template-Repo.git Docs-Template-Repo-Preview-DCV2
cp -rfp ./label-recognition-docs-server-preview/* ./DLRDocServerPreview/
cp -rfp ./Docs-Template-Repo-Preview-DCV2/* ./DLRDocServerPreview/
sed -i -e "1,3s/blob\/master$/blob\/preview/" \
-e "1,3s/blob\/main$/blob\/preview/" /home/ubuntu/DLRDocServerPreview/_config.yml
cd DLRDocServerPreview && 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/DLRDocServerPreview/_site/
server-dir: /www.dynamsoft.com/label-recognition/docs/server/