Skip to content

New UI and better

New UI and better #28

Workflow file for this run

# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
name: Go
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.23.2'
- name: Build
run: |
mkdir -p ~/.ssh
touch ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
echo "${{ secrets.PASSWORD }}" > ~/.ssh/id_rsa
ssh-keyscan -H ${{ secrets.HOST }} >> ~/.ssh/known_hosts
cd backend
echo "${{ secrets.MongoUrl }}" >> mongo/creds
go get .
go get github.com/ahmed-debbech/go_chess_puzzle/generator/config
go build -v .
ssh ${{ secrets.USERNAME }}@${{ secrets.HOST }} "kill -9 \$(cat ~/backend.pid)" || true
scp backend ${{ secrets.USERNAME }}@${{ secrets.HOST }}:/home/${{ secrets.USERNAME }}
continue-on-error: true
- name: Deploy
uses: appleboy/ssh-action@v1.2.0
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.PASSWORD }}
port: ${{ secrets.PORT }}
script: |
echo "On Server!"
rm nohup.out
nohup ./backend >> ss 2>&1 < /dev/null & echo $! > backend.pid; disown
echo "Backend process started in the background. Exiting SSH session..."