Forráskód Böngészése

增加自动部署 (#2)

LoGin 1 éve
szülő
commit
e5c01fa3a7
3 módosított fájl, 43 hozzáadás és 2 törlés
  1. 39 0
      .github/workflows/build.yml
  2. 3 1
      .gitignore
  3. 1 1
      package.json

+ 39 - 0
.github/workflows/build.yml

@@ -0,0 +1,39 @@
+name: Build and Deploy
+on: [ push, pull_request ]
+jobs:
+  build-and-deploy:
+    runs-on: ubuntu-latest
+    environment:
+      name: github-pages
+    steps:
+    - name: Checkout
+      uses: actions/checkout@v3
+      
+    - name: Setup Node.js environment
+      uses: actions/setup-node@v3.7.0
+      with:
+        node-version: "12.x"
+    
+    - name: Cache dependencies
+      id: cache-node-modules
+      uses: actions/cache@v3
+      env:
+        cache-name: cache-node-modules
+      with:
+        path: ./node_modules
+        key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('package.json') }}
+    
+    - if: ${{ steps.cache-node-modules.outputs.cache-hit != 'true' }}
+      name: Install dependencies
+      continue-on-error: true
+      run: npm install
+    
+    - name: Build
+      run: npm run docs:build
+    
+    - name: Deploy
+      uses: peaceiris/actions-gh-pages@v3
+      with:
+        deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
+        publish_dir: ./docs/.vuepress/dist
+

+ 3 - 1
.gitignore

@@ -1,2 +1,4 @@
 node_modules
-yarn.lock
+yarn.lock
+package-lock.json
+/docs/.vuepress/dist

+ 1 - 1
package.json

@@ -4,7 +4,7 @@
   "main": "index.js",
   "repository": "git@github.com:DragonOS-Community/rust_camp_tutorial.git",
   "author": "kong <376634352@qq.com>",
-  "license": "MIT",
+  "license": "GPL-2.0-only",
   "devDependencies": {
     "vuepress": "^1.9.9"
   },