Skip to content

ci(deploy): move host from secret to env #38

ci(deploy): move host from secret to env

ci(deploy): move host from secret to env #38

Workflow file for this run

on:
push:
branches:
- master
paths:
- ".github/**"
- "backend/**"
pull_request:
branches:
- master
env:
HOST: ${{ secrets.HOST }}
PORT: ${{ secrets.PORT }}
name: Build Tennis Backend
jobs:
build:
name: Build & Deploy
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup Go environment
uses: actions/setup-go@v2
with:
go-version: "1.23" # The Go version to download (if necessary) and use.
- name: Build
run: |
cd backend
go version
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o tennis-tournament-finder-backend cmd/main.go
pwd
ls -la
- name: Deploy
uses: appleboy/[email protected]
if: github.event_name != 'pull_request'
with:
host: ${{ env.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.SSH_KEY }}
port: ${{ env.PORT }}
source: "backend/tennis-tournament-finder-backend"
target: ${{ secrets.DEPLOYMENT_PATH }}
strip_components: 1
- name: Restart Service
uses: appleboy/ssh-action@master
if: github.event_name != 'pull_request'
with:
host: ${{ env.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.SSH_KEY }}
port: ${{ env.PORT }}
script: supervisorctl restart tennis-tournament-finder-backend