Skip to content

Fix get articles condition #34

Fix get articles condition

Fix get articles condition #34

name: Build and Deploy
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: '1.22.4'
- name: Cache Go Modules
uses: actions/cache@v4
with:
path: |
~/.cache/go-build
~/.cache/pkg
~/.config/gotestsum
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Build Server
run: go build -o server cmd/server/server.go
- name: Build Scheduler
run: go build -o scheduler cmd/scheduler/scheduler.go
- name: copy file via ssh key
uses: appleboy/[email protected]
with:
host: ${{ secrets.SERVER }}
username: ${{ secrets.USERNAME }}
port: 22
key: ${{ secrets.SSH_PRIVATE_KEY }}
source: "server,scheduler"
target: /tmp/
- name: Deploy and Start Services
uses: appleboy/[email protected]
with:
host: ${{ secrets.SERVER }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
port: 22
script: |
sudo mv /tmp/server /usr/local/bin/server
sudo mv /tmp/scheduler /usr/local/bin/scheduler
sudo chown appuser:appuser /usr/local/bin/server
sudo chown appuser:appuser /usr/local/bin/scheduler
sudo systemctl restart scheduler
sudo systemctl enable scheduler
sudo systemctl restart server
sudo systemctl enable server