-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d2accbd
commit e88a8f3
Showing
1 changed file
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: Deploy Golang Translator | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
pull_request: | ||
branches: [ "main" ] | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Deploy to Server | ||
uses: appleboy/[email protected] | ||
with: | ||
host: ${{ secrets.HOST }} | ||
username: ${{ secrets.USERNAME }} | ||
password: ${{ secrets.PASSWORD }} | ||
script: | | ||
echo "------> Setting GOPATH..." | ||
export GOPATH=$HOME/go | ||
export PATH=$PATH:/usr/local/go/bin:$GOPATH/bin | ||
echo "------> Changing to BackendTranslator directory..." | ||
cd /root/BackendTranslator | ||
echo "------> Setting environment variables..." | ||
. ./set_env_variables.sh | ||
echo "------> Pulling latest changes from Git..." | ||
git pull origin main | ||
echo "------> Building the application..." | ||
go build | ||
echo "------> Stopping BackendTranslator service..." | ||
sudo systemctl stop BackendTranslator | ||
echo "------> Starting BackendTranslator service..." | ||
sudo systemctl start BackendTranslator | ||
echo "------> Deployment complete." |