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

59 lines
1.7 KiB
YAML
Raw Normal View History

2023-11-26 10:07:46 +00:00
name: deploy account
2021-08-18 09:25:08 +00:00
on:
push:
branches:
- master
- dev
paths:
2023-11-26 10:01:34 +00:00
- "account/**"
2023-11-26 10:08:23 +00:00
- ".github/workflows/deploy-account.yml"
2021-08-18 09:25:08 +00:00
workflow_dispatch:
jobs:
2023-11-26 10:01:34 +00:00
new-deploy-account:
name: Deploy
runs-on: ubuntu-latest
env:
LINGDOCS_NPM_TOKEN: ${{ secrets.LINGDOCS_NPM_TOKEN }}
2021-08-18 09:25:08 +00:00
steps:
2023-11-26 10:44:33 +00:00
- uses: actions/checkout@v3
2023-11-26 10:30:49 +00:00
- name: Cache NPM deps
uses: actions/cache@v3
2023-12-03 16:53:17 +00:00
# TODO: for some reason this cache is not helping
2023-11-26 10:30:49 +00:00
with:
2023-11-26 11:06:12 +00:00
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
path: ~/.npm
2021-08-18 09:25:08 +00:00
- run: |
2023-11-26 10:11:45 +00:00
npm install
2023-11-26 10:21:13 +00:00
# TODO: could save a bunch of install time by not requiring ps-react in the website/account-types
2023-11-26 10:13:28 +00:00
cd website
npm install
cd ..
2021-08-18 09:25:08 +00:00
cd account
npm install
2023-11-26 10:04:25 +00:00
npm run build
2023-11-26 10:01:34 +00:00
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
2023-11-26 10:26:46 +00:00
pm2 restart account