Merge pull request #5 from WhatNext-ID/dependabot/go_modules/plate-se… #50
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: PlatCode Backend (Golang) | |
| on: | |
| push: | |
| branches: ['main'] | |
| pull_request: | |
| branches: ['main'] | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v4 | |
| - name: Setup SSH | |
| if: github.event_name == 'push' | |
| run: | | |
| mkdir -p ~/.ssh | |
| echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_ed25519 | |
| chmod 600 ~/.ssh/id_ed25519 | |
| ssh-keyscan -p 22 -H ${{ secrets.SSH_HOST }} >> ~/.ssh/known_hosts | |
| - name: Deploy to server | |
| if: github.event_name == 'push' | |
| run: | | |
| ssh -i ~/.ssh/id_ed25519 \ | |
| ${{ secrets.SSH_USERNAME }}@${{ secrets.SSH_HOST }} << 'EOF' | |
| set -e | |
| if [ ! -d ~/PlateCode ]; then | |
| git clone https://github.com/WhatNext-ID/plate-code-detector ~/PlateCode | |
| fi | |
| cd ~/PlateCode | |
| git fetch origin | |
| git reset --hard origin/main | |
| cd plate-server | |
| docker compose --project-name platecode up --build -d | |
| docker compose --project-name platecode ps | |
| EOF |