This repository was archived by the owner on Jun 25, 2024. It is now read-only.
File tree 1 file changed +41
-0
lines changed
1 file changed +41
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : Deploy to server
2
+
3
+ on :
4
+ push :
5
+ branches :
6
+ - master
7
+
8
+ jobs :
9
+ build :
10
+ name : Build and Deploy
11
+ runs-on : ubuntu-latest
12
+ steps :
13
+ - name : Executing remote ssh commands using ssh key
14
+ uses : appleboy/ssh-action@master
15
+ with :
16
+ host : ${{ secrets.HOST }}
17
+ username : ${{ secrets.USERNAME }}
18
+ key : ${{ secrets.KEY }}
19
+ port : ${{ secrets.PORT }}
20
+ script : |
21
+ cd repos/AIKyaru
22
+ git pull origin master
23
+ COMMIT_ID=${{ github.sha }}
24
+ docker build -t aikyaru .
25
+ CONTAINER_ID=$(docker ps -a --format "table {{.ID}} {{.Names}}" -f "status=running" | awk 'NR>1 && $2 ~ /^aikyaru/ {print$1}')
26
+ [[ ! -z "$CONTAINER_ID" ]] && docker stop $CONTAINER_ID
27
+ docker run -d \
28
+ --name aikyaru_${COMMIT_ID:0:7} \
29
+ -e BOT_TOKEN=${{ secrets.BOT_TOKEN }} \
30
+ -v ${{ secrets.CONFIG_PATH }}/config.json:/app/config.json \
31
+ -v ${{ secrets.CONFIG_PATH }}/gameDB:/app/gameDB \
32
+ --restart unless-stopped \
33
+ --network mongo-network \
34
+ aikyaru
35
+
36
+ - name : Send message to Discord
37
+ uses : sarisia/actions-status-discord@v1
38
+ with :
39
+ webhook : ${{ secrets.DISCORD_WEBHOOK }}
40
+ title : " deploy"
41
+ color : 0x4BB543
You can’t perform that action at this time.
0 commit comments