forked from JunkFood02/Seal
-
-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
67 lines (55 loc) · 2.53 KB
/
.gitlab-ci.yml
File metadata and controls
67 lines (55 loc) · 2.53 KB
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
stages:
- build
variables:
# ?? THE FIX: Global cache ko project ke local .gradle se alag kar diya!
GRADLE_USER_HOME: "$CI_PROJECT_DIR/gradle_global_cache"
GRADLE_OPTS: "-Dorg.gradle.daemon=false"
# --- ? CACHE CONFIGURATION ---
cache:
key: "$CI_COMMIT_REF_SLUG"
paths:
# Ab GitLab is naye folder ko cache karega, project folder ko lock nahi karega
- gradle_global_cache/wrapper
- gradle_global_cache/caches
- jdk21/
build_job:
stage: build
image: mobiledevops/android-sdk-image:34.0.0-jdk17
before_script:
# --- ? SMART JAVA INSTALL ---
- |
if [ ! -d "$CI_PROJECT_DIR/jdk21" ]; then
echo "? Downloading Java 21 (Fresh Start)..."
curl -L https://download.oracle.com/java/21/latest/jdk-21_linux-x64_bin.tar.gz -o jdk21.tar.gz
tar -xzf jdk21.tar.gz
rm jdk21.tar.gz
EXTRACTED_DIR=$(find . -maxdepth 1 -type d -name "jdk-21*" | head -n 1)
mv "$EXTRACTED_DIR" jdk21
else
echo "? Using Cached Java 21"
fi
# Setup Java Path
- export JAVA_HOME="$CI_PROJECT_DIR/jdk21"
- export PATH="$JAVA_HOME/bin:$PATH"
# --- ? DECODE KEYSTORE ---
- echo "? Decoding Key..."
- echo "$ANDROID_SIGNING_KEY" | tr -d '\n\r ' | base64 --decode > "$CI_PROJECT_DIR/Mahesh.jks"
script:
# --- STEP 1: EXTRACT VERSION ---
- |
VERSION=$(grep -A 1 'val currentVersion: Version =' buildSrc/src/main/kotlin/Version.kt | grep -oP 'versionMajor = \K\d+' | head -1).$(grep -A 1 'val currentVersion: Version =' buildSrc/src/main/kotlin/Version.kt | grep -oP 'versionMinor = \K\d+' | head -1).$(grep -A 1 'val currentVersion: Version =' buildSrc/src/main/kotlin/Version.kt | grep -oP 'versionPatch = \K\d+' | head -1)
echo "? Building Version: $VERSION"
# --- STEP 2: FAST BUILD & SIGN ---
- bash ./gradlew assembleRelease --parallel --build-cache --no-daemon -Pandroid.injected.signing.store.file="$CI_PROJECT_DIR/Mahesh.jks" -Pandroid.injected.signing.store.password="$ANDROID_KEYSTORE_PASSWORD" -Pandroid.injected.signing.key.alias="$ANDROID_ALIAS" -Pandroid.injected.signing.key.password="$ANDROID_KEY_PASSWORD"
# --- STEP 3: FIND & SAVE ARTIFACTS ---
- mkdir -p release_output
- echo "? searching for APKs..."
- find app/build/outputs -name "*.apk"
- find app/build/outputs -name "*.apk" -exec cp {} release_output/ \;
- ls -l release_output/
# Only testing, no publish/release logic
artifacts:
name: "SealPlus-$CI_COMMIT_SHORT_SHA"
paths:
- release_output/*.apk
expire_in: 1 week