Skip to content

server change

server change #2

Workflow file for this run

name: Deploy Go Application
'on':
push:
paths:
- server/**
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Copy files to EC2
uses: appleboy/scp-action@master
with:
host: ${{ secrets.EC2_HOST }}
username: ${{ secrets.EC2_USER }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
port: ${{ secrets.SSH_PORT }}
source: server/
target: /home/seanwelch/
script: |
echo "Listing files in /home/seanwelch/"
ls -lah /home/seanwelch/
cd /home/seanwelch/server
- name: Build Go binary, restart application and Nginx
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.EC2_HOST }}
username: ${{ secrets.EC2_USER }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
port: ${{ secrets.SSH_PORT }}
script: |
cd ./server
source ~/.profile
go build -o bin/main
echo ${{ secrets.SUDO_PASSWORD }} | sudo -S systemctl stop farmec.service
echo ${{ secrets.SUDO_PASSWORD }} | sudo -S systemctl start farmec.service
echo ${{ secrets.SUDO_PASSWORD }} | sudo -S systemctl restart nginx