Skip to content

fix: restart service after deploy #82

fix: restart service after deploy

fix: restart service after deploy #82

Workflow file for this run

name: Simple Build
on:
push:
branches: [master]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Install Go
uses: actions/setup-go@v4
with:
go-version: 1.22.x
- name: Checkout code
uses: actions/checkout@v4
- name: Build
run: make build
- name: Upload build result
uses: actions/upload-artifact@v4
with:
name: bin
path: ./bin/app
deploy:
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Download bin file
uses: actions/download-artifact@v4
with:
name: bin
path: ./bin
- name: Transfer bin file to server
uses: appleboy/scp-action@master
with:
host: 217.16.27.70
username: ubuntu
key: ${{ secrets.PRIVATE_KEY }}
debug: true
source: "bin/app"
target: "/home/ubuntu"
- name: Transfer migrations files to server
uses: appleboy/scp-action@master
with:
host: 217.16.27.70
username: ubuntu
key: ${{ secrets.PRIVATE_KEY }}
debug: true
source: "migrations"
target: "/home/ubuntu/bin"
- name: chmod
uses: appleboy/ssh-action@master
with:
host: 217.16.27.70
username: ubuntu
key: ${{ secrets.PRIVATE_KEY }}
script: chmod 755 /home/ubuntu/bin/app
- name: restart service
uses: appleboy/ssh-action@master
with:
host: 217.16.27.70
username: ubuntu
key: ${{ secrets.PRIVATE_KEY }}
script: sudo systemctl restart api.service