Skip to content

Update README.md

Update README.md #62

Workflow file for this run

name: Go Build, Test, and Deploy
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build-and-test:
name: Build and Test
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.21.5
- name: Install Make
run: |
sudo apt update
sudo apt install -y make
- name: Build
run: make build
- name: Install dependencies
run: go mod tidy
- name: Run tests
run: go test -v ./...
deploy-to-ec2:
name: Deploy to EC2
needs: build-and-test
runs-on: ubuntu-latest
steps:
- name: Checkout the files
uses: actions/checkout@v2
- name: Deploy to Server
uses: easingthemes/ssh-deploy@main
env:
SSH_PRIVATE_KEY: ${{ secrets.EC2_SSH_KEY }}
REMOTE_HOST: ${{ secrets.HOST_DNS }}
REMOTE_USER: ${{ secrets.USERNAME }}
TARGET: ${{ secrets.TARGET_DIR }}
- name: Connect to EC2 instance
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST_DNS }}
username: ubuntu
key: ${{ secrets.EC2_SSH_KEY }}
script: |
cd any-fashion-gin-clean-code
git pull
# sudo docker-compose down # Stop running containers
# sudo docker-compose build
# sudo docker-compose-up # Recreate and start containers