Deploy #40
This file contains hidden or 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: | |
| workflow_dispatch: | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - uses: actions/setup-node@v2 | |
| with: | |
| node-version: 16 | |
| - name: Install | |
| run: npm ci | |
| - name: Build | |
| run: npm run build:prod | |
| - name: Install SSH key | |
| uses: shimataro/ssh-key-action@v2 | |
| with: | |
| key: ${{ secrets.STATOSCOPE_TECH_SSH_KEY }} | |
| known_hosts: ${{ secrets.STATOSCOPE_TECH_SSH_KNOWN_HOSTS }} | |
| config: | | |
| Host statoscope.tech | |
| User ${{ secrets.STATOSCOPE_TECH_SSH_USER }} | |
| - name: Upload | |
| run: | | |
| ssh statoscope.tech 'cd statoscope.tech; rm -rf public_tmp' | |
| scp -r ./public statoscope.tech:statoscope.tech/public_tmp | |
| scp ./docker-compose.yml statoscope.tech:statoscope.tech/docker-compose.yml | |
| scp -r ./server statoscope.tech:statoscope.tech | |
| ssh statoscope.tech 'cd statoscope.tech; rm -rf public/*; mv public_tmp/* public/' | |
| - name: Restart server | |
| run: ssh statoscope.tech 'cd statoscope.tech; sudo docker compose up --force-recreate -d' |