Skip to content

Commit 27ccf0d

Browse files
committed
Merge branch 'abhiram6121-CI'
2 parents 182fd78 + db96920 commit 27ccf0d

File tree

2 files changed

+62
-4
lines changed

2 files changed

+62
-4
lines changed

.github/workflows/CI.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,47 @@ jobs:
3737
versionCode: ${{ steps.get_version.outputs.VERSION_CODE }}
3838
versionName: ${{ steps.get_version.outputs.VERSION_NAME }}
3939

40+
- name: Configure Build Signing
41+
run: |
42+
if [ ! -z "${{ secrets.SIGNING_KEY }}" ]; then
43+
echo "storePassword='${{ secrets.KEY_STORE_PASSWORD }}'" > smarttubetv/keystore.properties
44+
echo "keyAlias='${{ secrets.ALIAS }}'" >> smarttubetv/keystore.properties
45+
echo "keyPassword='${{ secrets.KEY_PASSWORD }}'" >> smarttubetv/keystore.properties
46+
echo "storeFile='../key.jks'" >> smarttubetv/keystore.properties
47+
echo "${{ secrets.SIGNING_KEY }}" | base64 --decode > key.jks
48+
fi
49+
4050
- name: Build with Gradle
4151
run: |
4252
chmod +x gradlew
4353
./gradlew clean assembleStbetaDebug
4454
55+
- name: VirusTotal Scan
56+
id: vt
57+
uses: crazy-max/ghaction-virustotal@v4
58+
with:
59+
vt_api_key: ${{ secrets.VIRUS_TOTAL_API_KEY }}
60+
files: |
61+
./smarttubetv/build/outputs/apk/stbeta/debug/*.apk
62+
request_rate: 3
63+
64+
- name: VirusTotal Summary
65+
run: |
66+
echo "### Security Scan Results" >> $GITHUB_STEP_SUMMARY
67+
echo "| Artifact Name | VirusTotal Status | Detailed Report |" >> $GITHUB_STEP_SUMMARY
68+
echo "| :--- | :--- | :--- |" >> $GITHUB_STEP_SUMMARY
69+
70+
for apk in ./smarttubetv/build/outputs/apk/stbeta/debug/*.apk; do
71+
filename=$(basename "$apk")
72+
sha256=$(sha256sum "$apk" | awk '{print $1}')
73+
74+
# Construct the dynamic badge URL using the hash
75+
badge_url="https://badges.cssnr.com/vt/id/$sha256?start=green&end=red&n=8"
76+
vt_link="https://www.virustotal.com/gui/file/$sha256"
77+
78+
echo "| $filename | ![$filename]($badge_url) | [View Report]($vt_link) |" >> $GITHUB_STEP_SUMMARY
79+
done
80+
4581
- name: Upload ARM64 APK
4682
uses: actions/upload-artifact@v6
4783
with:

smarttubetv/build.gradle

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ buildscript {
2424

2525
apply plugin: 'com.android.application'
2626

27+
def keystorePropertiesFile = rootProject.file("keystore.properties")
28+
def keystoreProperties = new Properties()
29+
if (keystorePropertiesFile.exists()) {
30+
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
31+
}
32+
2733
// First letter of flavor name must be in Uppercase
2834
if (new File("${projectDir}/google-services.json").exists() && (getGradle().getStartParameter().getTaskRequests().toString().contains("Stbeta") ||
2935
getGradle().getStartParameter().getTaskRequests().toString().contains("Ststable"))) {
@@ -75,6 +81,18 @@ android {
7581
}
7682
}
7783
}
84+
85+
signingConfigs {
86+
release {
87+
if (keystorePropertiesFile.exists()) {
88+
storeFile = file(keystoreProperties['storeFile'])
89+
storePassword = keystoreProperties['storePassword']
90+
keyAlias = keystoreProperties['keyAlias']
91+
keyPassword = keystoreProperties['keyPassword']
92+
}
93+
}
94+
}
95+
7896
buildTypes {
7997
release {
8098
// Enable minification
@@ -83,12 +101,16 @@ android {
83101

84102
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
85103

86-
// signingConfig signingConfigs.release
104+
if (keystorePropertiesFile.exists()) {
105+
signingConfig signingConfigs.release
106+
}
87107
}
88108
// Use same key for release and debug for testing
89-
// debug {
90-
// signingConfig signingConfigs.release
91-
// }
109+
debug {
110+
if (keystorePropertiesFile.exists()) {
111+
signingConfig signingConfigs.release
112+
}
113+
}
92114
}
93115

94116
// gradle 4.6 migration: disable dimensions mechanism

0 commit comments

Comments
 (0)