Skip to content

Repo --> Staging

Repo --> Staging #61

Workflow file for this run

name: Repo --> Staging
on:
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install dependencies to be able to build
run: npm ci
#
# this is required because the hosting doesn't allow ESM NodeJS so i need to convert it to CJS...
#
- name: Build
run: npm run build
- name: Copy package.json and package-lock.json
run: |
cp package.json server-to-upload/package.json
cp package-lock.json server-to-upload/package-lock.json
- name: Upload folder server-to-upload to FTP
uses: SamKirkland/[email protected]
with:
server: ${{ secrets.HOST }}
username: ${{ secrets.USER }}
password: ${{ secrets.PASS }}
server-dir: /wxr-server-staging/
local-dir: ./server-to-upload/
- name: SSH run install and restart
uses: appleboy/[email protected]
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USER }}
password: ${{ secrets.PASS }}
port: ${{ secrets.SSH_PORT }}
script: |
source /home/${{ secrets.USER }}/nodevenv/wxr-server-staging/20/bin/activate
cd /home/${{ secrets.USER }}/wxr-server-staging
npm ci --production
nohup kill $(ps aux | grep "wxr-server-staging" | awk '{print $2}') 2> /dev/null || echo "It was not running... anyway..." &