|
@@ -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
|