Skip to content

Create GH actions for testing and deploying (#262) #1

Create GH actions for testing and deploying (#262)

Create GH actions for testing and deploying (#262) #1

Workflow file for this run

name: Build and Deploy to flok.cc
on:
push:
branches:
- main
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Configure SSH
run: |
mkdir -p ~/.ssh/
echo "$SSH_KEY" > ~/.ssh/prod.key
chmod 600 ~/.ssh/prod.key
cat >>~/.ssh/config <<END
Host prod
HostName $SSH_HOST
User $SSH_USER
IdentityFile ~/.ssh/prod.key
StrictHostKeyChecking no
END
env:
SSH_USER: ${{ secrets.SSH_USER }}
SSH_KEY: ${{ secrets.SSH_KEY }}
SSH_HOST: ${{ secrets.SSH_HOST }}
- name: Build
run: ssh prod 'cd flok && git fetch && git reset --hard $GITHUB_SHA && npm install'
- name: Restart server
run: ssh prod 'sudo systemctl restart flok'
- name: Check status
run: ssh prod 'sudo systemctl status flok'