Skip to content

add a cross

add a cross #25

Workflow file for this run

name: Deploy to Hezner Cloud
on:
push:
branches:
- pipeline
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: "lts/*"
cache: "npm"
- name: Install Dependencies
run: |
npm install
- name: Build Next.js App
run: npm run build
- name: Set up SSH Key
run: |
mkdir -p ~/.ssh
echo "${{ secrets.EC2_SSH_KEY }}" > ~/.ssh/deploy_key
chmod 600 ~/.ssh/deploy_key
- name: Copy Files to Hezner Cloud
env:
EC2_HOST: [email protected]
run: |
mkdir -p deploy
tar -czf deploy/app.tar.gz .next package.json package-lock.json public app/scripts app/lib/db.ts app/types
scp -o StrictHostKeyChecking=no -i ~/.ssh/deploy_key deploy/app.tar.gz $EC2_HOST:~/app.tar.gz
- name: Deploy on Hezner Cloud
env:
EC2_HOST: [email protected]
run: |
ssh -o StrictHostKeyChecking=no -i ~/.ssh/deploy_key $EC2_HOST << EOF
mkdir -p ~/edx && tar -xzf ~/app.tar.gz -C ~/edx && cd ~/edx
npm install --production
pm2 stop all || true
pm2 start npm --name "edx" -- start
pm2 start app/scripts/update-balances.ts --name "edx-update-balances" --cron "*/5 * * * *" --no-autorestart --interpreter ts-node
pm2 save
EOF