fix: proper cache target #5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy | |
on: | |
push: | |
paths-ignore: | |
- '.github/**' | |
branches: | |
- main | |
workflow_dispatch: | |
# Jobs | |
jobs: | |
Update: | |
runs-on: self-hosted | |
strategy: | |
matrix: | |
hosts: [[email protected]] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Create deployment archive | |
run: | | |
mkdir deployment | |
tar --exclude='./deployment' --exclude='./.git' --exclude='./.github' -czvf deployment/code.tar.gz . | |
- name: Stop PM2 Advance | |
run: ssh ${{ matrix.hosts }} "pm2 stop advance" | |
- name: Copy new code via SCP | |
run: scp deployment/code.tar.gz ${{ matrix.hosts }}:~/Advance | |
- name: Deploy new code | |
run: ssh ${{ matrix.hosts }} "cd ~/Advance && tar -xzf code.tar.gz && rm code.tar.gz" | |
- name: Install dependencies and start Advance | |
run: ssh ${{ matrix.hosts }} "cd ~/Advance && npm i && pm2 restart advance && pm2 save" |