main.yml 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. name: CI
  2. on:
  3. push:
  4. branches: [ master ]
  5. pull_request:
  6. branches: [ master ]
  7. jobs:
  8. build:
  9. strategy:
  10. matrix:
  11. node-version: [12.x]
  12. runs-on: ubuntu-latest
  13. steps:
  14. - name: Check out branch
  15. uses: actions/checkout@v4
  16. - name: Get Composer Cache Directory
  17. id: composer-cache
  18. run: |
  19. echo "::set-output name=dir::$(composer config cache-files-dir)"
  20. - uses: actions/cache@v2
  21. with:
  22. path: ${{ steps.composer-cache.outputs.dir }}
  23. key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
  24. restore-keys: |
  25. ${{ runner.os }}-composer-
  26. - name: Install dependencies
  27. uses: actions/composer@v2
  28. with:
  29. composer-file: composer.json
  30. composer-args: "install --no-dev"
  31. - name: Deploy
  32. run: |
  33. ssh -p 2222 jianboy@xx.com
  34. cd ~/xx/xx/xx/
  35. mv _4_5OI.git .git
  36. git fetch origin master
  37. git reset --hard origin/master
  38. mv .git _4_5OI.git
  39. - name: build docker images and push
  40. run: |
  41. docker build -t jianboy/blog.yoqi.me:latest .
  42. docker push jianboy/blog.yoqi.me:latest
  43. - name: Deploy with Docker
  44. run: |
  45. ssh -p 2222
  46. docker-compose up -d