diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index a09f980..9a591b6 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -1,3 +1,6 @@ +# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions + name: Node.js CI on: @@ -7,34 +10,28 @@ on: branches: [ master ] jobs: - deploy: + deploy_build_run: runs-on: ubuntu-latest + strategy: + matrix: + node-version: [14.x] + steps: - - name: Deploy to SSH - uses: appleboy/ssh-action@v0.1.4 - with: - host: ${{ secrets.SSH_HOST }} - port: ${{ secrets.SSH_PORT }} - username: ${{ secrets.SSH_USER }} - key: ${{ secrets.SSH_KEY }} - passphrase: ${{ secrets.SSH_PASSPHRASE }} - script: | - cd ${{ secrets.PATH }} - git pull origin master -r artapi artapi-new - cd artapi-new - git fetch --all - git reset --hard origin/master - yarn install --only=master - node ace build --production - cp .env build/.env - - cd .. - mv artapi artapi-old - mv artapi-new artapi - - # Restart server - - cd artapi - pm2 kill - pm2 start build/server.js --name artapi - rm -rf ../artapi-old + - uses: actions/checkout@v1 + - name: Use Node.js ${{ matrix.node_version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node_version }} + - name: Deploy with SSH + uses: appleboy/ssh-action@v0.1.4 + with: + host: ${{ secrets.SSH_HOST }} + port: ${{ secrets.SSH_PORT }} + username: ${{ secrets.SSH_USER }} + password: ${{ secrets.SSH_PASSPHRASE }} + script: | + cd ${{ secrets.PATH }} + git pull + yarn install + yarn build + pm2 start