Skip to content

github actions

github actions #1

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/,other-configs/
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
sudo systemctl stop farmec.service
sudo systemctl start farmec.service
sudo systemctl restart nginx