Skip to content

Commit

Permalink
fix: preserve prod database through re-deployments
Browse files Browse the repository at this point in the history
  • Loading branch information
sparky-raccoon committed Jan 14, 2024
1 parent 4f4890b commit 9476aac
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,15 @@ jobs:
run: yarn run build
- name: Stop previous epitome pm2 process
run: pm2 delete epitome 2> /dev/null || true
- name: Create a database backup
run: cp ~/apps/database.sqlite ~/.epitome.database.sqlite.backup
- name: Prepare application directory
run: rm -rf ~/apps/epitome && mkdir ~/apps/epitome
- name: Move build contents & dependencies to application directory
run: mv dist/* ~/apps/epitome && mv node_modules ~/apps/epitome
- name: Export token and client id as environment variables
run: export TOKEN=$TOKEN && export CLIENT_ID=$CLIENT_ID
- name: Restore database backup
run: cp ~/.epitome.database.sqlite.backup ~/apps/epitome/database.sqlite && rm ~/.epitome.database.sqlite.backup
- name: Start new epitome pm2 process
run: cd ~/apps/epitome && pm2 start -f index.js --name epitome && pm2 save

0 comments on commit 9476aac

Please sign in to comment.