Skip to content

Commit 85d469e

Browse files
committed
feat: add github workflow to deploy to demo
1 parent 61573af commit 85d469e

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

.github/workflows/main.yml

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# This is a basic workflow to help you get started with Actions
2+
3+
name: CI
4+
5+
# Controls when the workflow will run
6+
on:
7+
# Allows you to run this workflow manually from the Actions tab
8+
workflow_dispatch:
9+
10+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
11+
jobs:
12+
# This workflow contains a single job called "build"
13+
Build-Demo:
14+
if: ${{ github.ref == 'refs/heads/demo' }}
15+
16+
# The type of runner that the job will run on
17+
runs-on: self-hosted
18+
env:
19+
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
20+
21+
# Steps represent a sequence of tasks that will be executed as part of the job
22+
steps:
23+
# Runs a set of commands using the runners shell
24+
- name: Get Source
25+
run: |
26+
cd /home/ubuntu
27+
[ -d document-scanner-javascript ] && rm -rf document-scanner-javascript
28+
git clone --depth 1 -b demo https://github.com/Dynamsoft/document-scanner-javascript.git
29+
30+
- name: Prepare Files
31+
run: |
32+
# Create a temporary directory for the files to be uploaded
33+
mkdir -p /home/ubuntu/document-scanner-javascript/demo
34+
35+
# Copy the dist folder
36+
cp -r /home/ubuntu/document-scanner-javascript/dist /home/ubuntu/document-scanner-javascript/demo
37+
38+
# Copy the samples folder and rename demo.html to index.html
39+
cp -r /home/ubuntu/document-scanner-javascript/samples/* /home/ubuntu/document-scanner-javascript/demo
40+
mv /home/ubuntu/deployment/samples/demo.html /home/ubuntu/deployment/samples/index.html
41+
42+
43+
- name: Sync files
44+
uses: SamKirkland/[email protected]
45+
with:
46+
server: ${{ secrets.FTP_DEMO_SERVER }}
47+
username: ${{ secrets.FTP_DEMO_USERNAME }}
48+
password: ${{ secrets.FTP_DEMO_PASSWORD }}
49+
port: 21
50+
local-dir: /home/ubuntu/document-scanner-javascript/demo
51+
server-dir: /Demo.dynamsoft.com/document-scanner/

0 commit comments

Comments
 (0)