pashto-dictionary/.github/workflows/deploy-account.yml

56 lines
1.4 KiB
YAML

name: deploy account
on:
push:
branches:
- master
- dev
paths:
- "account/**"
- ".github/workflows/deploy-account.yml"
workflow_dispatch:
jobs:
new-deploy-account:
name: Deploy
runs-on: ubuntu-latest
env:
LINGDOCS_NPM_TOKEN: ${{ secrets.LINGDOCS_NPM_TOKEN }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: "npm"
- run: |
npm install
cd website
npm install
cd ..
cd account
npm install
npm run build
npm prune --production
cd ..
tar --exclude-vcs -czf account.tar.gz account
- name: copy tarball to server
uses: appleboy/scp-action@v0.1.4
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
port: ${{ secrets.PORT }}
key: ${{ secrets.KEY }}
source: "account.tar.gz"
target: "."
- name: unpack tarball and restart app
uses: appleboy/ssh-action@v1.0.3
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.KEY }}
port: ${{ secrets.PORT }}
script: |
rm -rf apps/live/account
tar -xzf account.tar.gz -C ~/apps/live
rm account.tar.gz
pm2 restart account