-
Notifications
You must be signed in to change notification settings - Fork 0
55 lines (55 loc) · 1.76 KB
/
main-websocket.yml
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
name: GraalVM build Websocket
on:
push:
branches:
- 'main'
paths:
- 'micro-websocket/**'
- 'build.gradle.kts'
- 'common/**'
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Check out Code
uses: actions/checkout@v4
- name: Prepare
uses: graalvm/setup-graalvm@v1
with:
java-version: '23' # See 'Options' section below for all supported versions
distribution: 'graalvm' # See 'Options' section below for all available distributions
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Print Info
run: |
echo "GRAALVM_HOME: $GRAALVM_HOME"
echo "JAVA_HOME: $JAVA_HOME"
java --version
native-image --version
- name: Build
run: ./gradlew :micro-websocket:bootBuildImage
env:
DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKER_PWD: ${{ secrets.DOCKERHUB_PWD }}
deploy:
name: Deploy
runs-on: ubuntu-latest
needs:
- build
steps:
- name: Deploy
uses: appleboy/[email protected]
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
port: ${{ secrets.PORT }}
script: |
docker pull mingchiuli/megalith-micro-websocket:latest
docker stop $(docker ps | grep 'micro-websocket' | awk '{print $1}')
docker rm $(docker ps -a | grep 'micro-websocket' | awk '{print $1}')
docker compose --compatibility up -d --no-recreate
code=$(docker images | grep 'micro-websocket' | grep 'none' | awk '{print $3}')
if [ -n "$code" ]; then
docker rmi $code
fi