Browse Source

add action

liuyuqi-dellpc 1 year ago
parent
commit
c2073ebd94
2 changed files with 55 additions and 1 deletions
  1. 53 0
      .github/workflows/build.yml
  2. 2 1
      README.md

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

@@ -0,0 +1,53 @@
+name: CI
+
+on:
+  push:
+    branches: [ master ]
+  pull_request:
+    branches: [ master ]
+
+jobs:
+  build:
+    strategy:
+      matrix:
+        node-version: [12.x]
+    runs-on: ubuntu-latest
+    steps:
+      - name: Check out branch
+        uses: actions/checkout@v2
+
+      - name: Get Composer Cache Directory
+        id: composer-cache
+        run: |
+          echo "::set-output name=dir::$(composer config cache-files-dir)"
+      - uses: actions/cache@v2
+        with:
+          path: ${{ steps.composer-cache.outputs.dir }}
+          key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
+          restore-keys: |
+            ${{ runner.os }}-composer-
+     
+      - name: Install dependencies
+        uses: actions/composer@v2
+        with:
+          composer-file: composer.json
+          composer-args: "install --no-dev"
+       
+      - name: Deploy
+        run: |
+          ssh -p 2222 jianboy@xx.com
+          cd ~/xx/xx/xx/
+          mv _4_5OI.git .git
+          git fetch origin master
+          git reset --hard origin/master
+          mv .git _4_5OI.git
+
+      - name: build docker images and push 
+        run: |
+        docker build -t jianboy/blog.yoqi.me:latest .
+        docker push jianboy/blog.yoqi.me:latest
+
+      - name: Deploy with Docker
+        run: |
+        ssh -p 2222 
+        docker-compose up -d

+ 2 - 1
README.md

@@ -11,4 +11,5 @@ git clone https://git.yoqi.me/zhizhou/survey.yoqi.me.git
 
 ## License
 
-## Reference
+## Reference
+