Skip to content

Repo --> Staging

Repo --> Staging #34

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 i esm-cjs javascript-obfuscator
#
# this is required because the hosting doesn't allow ESM NodeJS so i need to convert it to CJS...
#
- name: Build
run: node export-esm-to-cjs.cjs
- name: Upload folder server-to-upload to FTP
uses: SamKirkland/FTP-Deploy-Action@4.3.3
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/ssh-action@v0.1.4
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USER }}
password: ${{ secrets.PASS }}
port: ${{ secrets.SSH_PORT }}
script: |
source /home/${{ secrets.USER }}/nodevenv/wxr-server-staging/14/bin/activate
cd /home/${{ secrets.USER }}/wxr-server-staging
npm install
nohup kill $(ps aux | grep "wxr-server-staging" | awk '{print $2}') 2> /dev/null || echo "It was not running... anyway..." &