瀏覽代碼

Add deployment workflow

Giovanni Giordano 5 年之前
父節點
當前提交
9504f93e94
共有 2 個文件被更改,包括 39 次插入3 次删除
  1. 23 0
      .github/workflows/deploy.yml
  2. 16 3
      .github/workflows/nodejs.yml

+ 23 - 0
.github/workflows/deploy.yml

@@ -0,0 +1,23 @@
+name: Deploy to GitHub Pages
+
+on:
+  push:
+    branches:
+      - master
+jobs:
+  build-and-deploy:
+    runs-on: ubuntu-latest
+    steps:
+    - uses: actions/checkout@v1
+
+    - name: Build
+      run: |
+        npm ci
+        npm RUN build
+
+    - name: Deploy
+      uses: JamesIves/github-pages-deploy-action@releases/v3
+      with:
+        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+        BRANCH: gh-pages
+        FOLDER: BUILD

+ 16 - 3
.github/workflows/nodejs.yml

@@ -3,18 +3,31 @@ name: Node CI
 on: [push]
 
 jobs:
-  test:
+  build:
 
     runs-on: ubuntu-latest
 
     steps:
     - uses: actions/checkout@v1
-    - uses: actions/setup-node@v1
+    - name: Setup Node.js 12.x
+      uses: actions/setup-node@v1
       with:
         node-version: 12.x
-    - name: npm install and test
+
+    - name: Install and test
       run: |
         npm ci
         npm test
       env:
         CI: true
+
+    - name: Build
+      run: |
+        npm run  build
+
+    - name: Deploy
+      uses: JamesIves/github-pages-deploy-action@releases/v3
+      with:
+        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+        BRANCH: gh-pages
+        FOLDER: dist