-
Notifications
You must be signed in to change notification settings - Fork 0
61 lines (45 loc) · 1.67 KB
/
deploy.yml
File metadata and controls
61 lines (45 loc) · 1.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
name: Golang
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Go 1.18
uses: actions/setup-go@v1
with:
go-version: 1.18
- name: Deploy App and Deploy
uses: appleboy/ssh-action@v0.1.2
with:
host: ${{secrets.SSH_HOST}} # IP address of the server you wish to ssh into
key: ${{secrets.SSH_KEY}} # Private or public key of the server
username: ${{ secrets.SSH_USERNAME }} # User of the server you want to ssh into
script: |
export NVM_DIR=~/.nvm
source ~/.nvm/nvm.sh
PATH="/usr/local/go/bin/:$PATH"
cd /root
cd go
cd deploying
echo "Cloning Git Repo to /root/deploying"
git clone https://aldhanekaa:${{secrets.GITHUB_TOKEN}}@github.com/aldhanekaa/Golang-audio-chat.git
echo "Building Golang source"
cd Golang-audio-chat
go build
echo "Moving Builded Golang Source to /root/go/Golang-audio-chat"
rm -rf /root/go/Golang-audio-chat
mv /root/go/deploying/Golang-audio-chat /root/go/Golang-audio-chat
cd client
npm i
npm run build
echo "Moving FrontEnd to /var/www/golang-webchat.sg.aldhaneka.me"
rm -rf /var/www/golang-webchat.sg.aldhaneka.me
mv dist /var/www/golang-webchat.sg.aldhaneka.me
cd ..
rm -rf client
sudo systemctl stop golang-webchat.service
sudo systemctl start golang-webchat.service
sudo service nginx reload