-
Notifications
You must be signed in to change notification settings - Fork 2
79 lines (76 loc) · 3.44 KB
/
deploy.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
name: Deploy
on:
workflow_dispatch:
push:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
repository: 'jcardus/traccar'
ref: 'master'
- uses: actions/checkout@v4
with:
path: configuration
- name: update templates
run: |
rm -rf configuration/.git
cp -vr configuration/templates/* templates
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
cache: gradle
- run: ./gradlew build --no-daemon
- name: Build installers
working-directory: ./setup
run: |
sudo apt-get install makeself
wget -q https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.2+13/OpenJDK21U-jdk_x64_linux_hotspot_21.0.2_13.tar.gz
mkdir -p out/{conf,data,lib,logs,web,schema,templates}
cp ../target/tracker-server.jar out
cp ../target/lib/* out/lib
cp ../schema/* out/schema
cp -r ../templates/* out/templates
cp traccar.xml out/conf
cp setup.sh out
cp traccar.service out
tar -xf OpenJDK21U-jdk_x64_linux_hotspot_21.0.2_13.tar.gz
jlink --module-path jdk-*/jmods --add-modules java.se,jdk.charsets,jdk.crypto.ec,jdk.unsupported --output out/jre
rm -rf jdk-*
makeself --needroot --quiet --notemp out traccar.run "traccar" ./setup.sh
mkdir deploy
mv traccar.run deploy
mv traccar.xml deploy
- run: |
sed -i "s/\${SMTP_PASSWORD}/${{secrets.SMTP_PASSWORD}}/g" configuration/traccar.xml
sed -i "s/\${SMTP_USER_NAME}/${{secrets.SMTP_USER_NAME}}/g" configuration/traccar.xml
sed -i "s/\${MAIL_SMTP_FROM}/${{secrets.MAIL_SMTP_FROM}}/g" configuration/traccar.xml
sed -i "s/\${DATABASE_HOST}/${{secrets.DATABASE_HOST}}/g" configuration/traccar.xml
sed -i "s/\${DATABASE_PASSWORD}/${{secrets.DATABASE_PASSWORD}}/g" configuration/traccar.xml
sed -i "s/\${DATABASE_USER}/${{secrets.DATABASE_USER}}/g" configuration/traccar.xml
sed -i "s/\${SMS_HTTP_AUTHORIZATION}/${{secrets.SMS_HTTP_AUTHORIZATION}}/g" configuration/traccar.xml
sed -i "s/\${GEOCODER_KEY}/${{secrets.GEOCODER_KEY}}/g" configuration/traccar.xml
sed -i "s/\${GEOLOCATION_KEY}/${{secrets.GEOLOCATION_KEY}}/g" configuration/traccar.xml
sed -i "/\${NOTIFICATOR_FIREBASE_SERVICE_ACCOUNT}/r /dev/stdin" configuration/traccar.xml <<'EOF'
<entry key='notificator.firebase.serviceAccount'>${{ secrets.NOTIFICATOR_FIREBASE_SERVICE_ACCOUNT }}</entry>
EOF
sed -i "/\${NOTIFICATOR_FIREBASE_SERVICE_ACCOUNT}/d" configuration/traccar.xml
cp -rv configuration/* setup/deploy
cat configuration/traccar.xml
- name: ssh deploy
uses: easingthemes/ssh-deploy@main
with:
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
ARGS: "-rlgoDzvc -i"
SOURCE: "setup/deploy"
REMOTE_HOST: ${{ secrets.REMOTE_HOST }}
REMOTE_USER: ${{ secrets.REMOTE_USER }}
TARGET: ${{ secrets.REMOTE_TARGET }}
SCRIPT_AFTER: |
sudo /home/${{ secrets.REMOTE_USER }}/deploy/traccar.run
sudo cp -v /home/${{ secrets.REMOTE_USER }}/deploy/traccar.xml /opt/traccar/conf/
sudo service traccar start
echo $RSYNC_STDOUT