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

59 lines
1.7 KiB
YAML
Raw Normal View History

2024-08-14 19:30:10 +00:00
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@v3
- name: Cache NPM deps
uses: actions/cache@v3
# TODO: for some reason this cache is not helping
with:
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
path: ~/.npm
- run: |
npm install
# TODO: could save a bunch of install time by not requiring ps-react in the website/account-types
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.0
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