Skip to content

Commit 90bd34e

Browse files
committed
Add release workflow
1 parent d973715 commit 90bd34e

5 files changed

Lines changed: 158 additions & 14 deletions

File tree

.github/dependabot.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "gradle"
4+
directory: "/"
5+
schedule:
6+
interval: "monthly"
7+
- package-ecosystem: "github-actions"
8+
directory: "/"
9+
schedule:
10+
interval: "monthly"

.github/workflows/release.yml

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags: ['v*']
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v6
12+
13+
- uses: actions/setup-java@v5
14+
with:
15+
distribution: temurin
16+
java-version: 17
17+
18+
- uses: gradle/actions/setup-gradle@v6
19+
20+
- name: Decode release keystore
21+
env:
22+
KEYSTORE_BASE64: ${{ secrets.RELEASE_KEYSTORE_BASE64 }}
23+
run: echo "$KEYSTORE_BASE64" | base64 -d > "$RUNNER_TEMP/release.keystore"
24+
25+
- name: Write keystore.properties
26+
env:
27+
KEYSTORE_PASSWORD: ${{ secrets.RELEASE_KEYSTORE_PASSWORD }}
28+
KEY_ALIAS: ${{ secrets.RELEASE_KEY_ALIAS }}
29+
KEY_PASSWORD: ${{ secrets.RELEASE_KEY_PASSWORD }}
30+
run: |
31+
{
32+
echo "storeFile=$RUNNER_TEMP/release.keystore"
33+
echo "storePassword=$KEYSTORE_PASSWORD"
34+
echo "keyAlias=$KEY_ALIAS"
35+
echo "keyPassword=$KEY_PASSWORD"
36+
} > keystore.properties
37+
38+
- name: Build release artifacts
39+
run: ./gradlew :app:assembleTraccarRelease
40+
41+
- uses: actions/upload-artifact@v4
42+
with:
43+
name: traccar-apk
44+
path: app/build/outputs/apk/traccar/release/sms-messenger-traccar-release.apk
45+
if-no-files-found: error
46+
47+
smoke-test:
48+
needs: build
49+
runs-on: ubuntu-latest
50+
steps:
51+
- name: Enable KVM
52+
run: |
53+
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
54+
sudo udevadm control --reload-rules
55+
sudo udevadm trigger --name-match=kvm
56+
57+
- uses: actions/download-artifact@v4
58+
with:
59+
name: traccar-apk
60+
path: .
61+
62+
- name: Launch emulator and verify app starts
63+
uses: reactivecircus/android-emulator-runner@v2
64+
with:
65+
api-level: 34
66+
target: google_apis
67+
arch: x86_64
68+
profile: pixel_6
69+
disable-animations: true
70+
script: |
71+
adb wait-for-device
72+
adb install -r sms-messenger-traccar-release.apk
73+
adb shell monkey -p org.traccar.gateway -c android.intent.category.LAUNCHER 1
74+
sleep 10
75+
adb shell screencap -p /sdcard/launch.png
76+
adb pull /sdcard/launch.png launch.png
77+
adb shell pidof org.traccar.gateway > /dev/null || { echo "App process not running after launch — crashed."; exit 1; }
78+
79+
- uses: actions/upload-artifact@v4
80+
with:
81+
name: launch-screenshot
82+
path: launch.png
83+
if-no-files-found: error
84+
85+
publish:
86+
needs: smoke-test
87+
runs-on: ubuntu-latest
88+
permissions:
89+
contents: write
90+
steps:
91+
- uses: actions/download-artifact@v4
92+
with:
93+
name: traccar-apk
94+
path: traccar-apk
95+
96+
- name: Upload to Google Play (production)
97+
uses: r0adkll/upload-google-play@v1
98+
with:
99+
serviceAccountJsonPlainText: ${{ secrets.PLAY_SERVICE_ACCOUNT_JSON }}
100+
packageName: org.traccar.gateway
101+
releaseFiles: traccar-apk/sms-messenger-traccar-release.apk
102+
tracks: production
103+
status: completed
104+
105+
- name: Create GitHub Release
106+
uses: softprops/action-gh-release@v2
107+
with:
108+
files: traccar-apk/sms-messenger-traccar-release.apk

app/.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
/build
2-
google-services.json

app/build.gradle.kts

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -125,16 +125,3 @@ dependencies {
125125
"traccarImplementation"(libs.firebase.crashlytics)
126126
"traccarImplementation"(libs.firebase.messaging)
127127
}
128-
129-
tasks.register<Copy>("copyFirebaseConfig") {
130-
from("../../environment/firebase")
131-
into(".")
132-
include("traccar-sms-gateway.json")
133-
rename("traccar-sms-gateway.json", "google-services.json")
134-
}
135-
136-
afterEvaluate {
137-
tasks.matching { it.name.contains("Traccar") }.configureEach {
138-
dependsOn("copyFirebaseConfig")
139-
}
140-
}

app/google-services.json

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"project_info": {
3+
"project_number": "575752507358",
4+
"firebase_url": "https://traccar-sms-gateway.firebaseio.com",
5+
"project_id": "traccar-sms-gateway",
6+
"storage_bucket": "traccar-sms-gateway.appspot.com"
7+
},
8+
"client": [
9+
{
10+
"client_info": {
11+
"mobilesdk_app_id": "1:575752507358:android:878b2efb1cb9020b68d74f",
12+
"android_client_info": {
13+
"package_name": "org.traccar.gateway"
14+
}
15+
},
16+
"oauth_client": [
17+
{
18+
"client_id": "575752507358-86aide2lps8kgr0v3gqs2uo87jcv081s.apps.googleusercontent.com",
19+
"client_type": 3
20+
}
21+
],
22+
"api_key": [
23+
{
24+
"current_key": "AIzaSyCgMvMeRbnRZLB3rUNhGUEmwDfG-c7r53k"
25+
}
26+
],
27+
"services": {
28+
"appinvite_service": {
29+
"other_platform_oauth_client": [
30+
{
31+
"client_id": "575752507358-86aide2lps8kgr0v3gqs2uo87jcv081s.apps.googleusercontent.com",
32+
"client_type": 3
33+
}
34+
]
35+
}
36+
}
37+
}
38+
],
39+
"configuration_version": "1"
40+
}

0 commit comments

Comments
 (0)