ai-chat-android-auto / files / .fw-ci.yml
.fw-ci.yml
| 1 | # Triggered on any tag push. Push a tag of the form v1.2.3 to produce a |
| 2 | # signed release APK and publish it to the project's Releases page. |
| 3 | # |
| 4 | # Required CI/CD variables (Settings → CI/CD → Variables, both masked): |
| 5 | # KEYSTORE_BASE64 – release keystore encoded as base64 |
| 6 | # (generate with: base64 -i claudeauto-release.jks | pbcopy) |
| 7 | # KEYSTORE_PASSWORD – keystore password (used for both store and key) |
| 8 | |
| 9 | stages: |
| 10 | - build |
| 11 | - release |
| 12 | |
| 13 | variables: |
| 14 | ANDROID_HOME: "$CI_PROJECT_DIR/.android-sdk" |
| 15 | ANDROID_SDK_ROOT: "$CI_PROJECT_DIR/.android-sdk" |
| 16 | |
| 17 | build: |
| 18 | stage: build |
| 19 | image: eclipse-temurin:17-jdk-focal |
| 20 | rules: |
| 21 | - if: $CI_COMMIT_TAG |
| 22 | cache: |
| 23 | key: android-sdk-gradle |
| 24 | paths: |
| 25 | - .android-sdk/ |
| 26 | - .gradle/ |
| 27 | before_script: |
| 28 | # Install OS tools |
| 29 | - apt-get update -qq && apt-get install -y -qq unzip curl |
| 30 | # Download Android command-line tools if not restored from cache |
| 31 | - | |
| 32 | if [ ! -f "$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager" ]; then |
| 33 | echo "Downloading Android command-line tools..." |
| 34 | curl --fail --silent --show-error \ |
| 35 | https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip \ |
| 36 | -o /tmp/cmdline-tools.zip |
| 37 | mkdir -p "$ANDROID_HOME/cmdline-tools" |
| 38 | unzip -q /tmp/cmdline-tools.zip -d /tmp/ct |
| 39 | mv /tmp/ct/cmdline-tools "$ANDROID_HOME/cmdline-tools/latest" |
| 40 | rm -rf /tmp/cmdline-tools.zip /tmp/ct |
| 41 | fi |
| 42 | - export PATH="$ANDROID_HOME/cmdline-tools/latest/bin:$ANDROID_HOME/platform-tools:$PATH" |
| 43 | # Pre-accept licences by writing the known SHA1 hashes (more reliable than `yes | sdkmanager --licenses`) |
| 44 | - mkdir -p "$ANDROID_HOME/licenses" |
| 45 | - printf '\n24333f8a63b6825ea9c5514f83c2829b004d1fee\nd56f5187479451eabf01fb78af6dfcb131a6481e\n8933bad161af4178b1185d1a37fbf41ea5269c55' > "$ANDROID_HOME/licenses/android-sdk-license" |
| 46 | - printf '\n84831b9409646a918e30573bab4c9c91346d8abd\n504667f4c0de7af1a06de9f4b1727b84351f2910' > "$ANDROID_HOME/licenses/android-sdk-preview-license" |
| 47 | - sdkmanager "platforms;android-34" "build-tools;34.0.0" "platform-tools" |
| 48 | # Write signing config |
| 49 | - chmod +x ./gradlew |
| 50 | - echo "$KEYSTORE_BASE64" | base64 -d > keystore.jks |
| 51 | - echo "release.storeFile=../keystore.jks" > local.properties |
| 52 | - echo "release.storePassword=$KEYSTORE_PASSWORD" >> local.properties |
| 53 | - echo "release.keyAlias=claudeauto" >> local.properties |
| 54 | - echo "release.keyPassword=$KEYSTORE_PASSWORD" >> local.properties |
| 55 | script: |
| 56 | - ./gradlew assembleRelease |
| 57 | - | |
| 58 | curl --silent --show-error --fail \ |
| 59 | --header "JOB-TOKEN: $CI_JOB_TOKEN" \ |
| 60 | --upload-file app/build/outputs/apk/release/app-release.apk \ |
| 61 | "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/apk/${CI_COMMIT_TAG}/ai-chat-android-auto-${CI_COMMIT_TAG}.apk" |
| 62 | artifacts: |
| 63 | name: "ai-chat-android-auto-$CI_COMMIT_TAG" |
| 64 | paths: |
| 65 | - app/build/outputs/apk/release/app-release.apk |
| 66 | expire_in: 30 days |
| 67 | |
| 68 | release: |
| 69 | stage: release |
| 70 | image: registry.gitlab.com/gitlab-org/release-cli:latest |
| 71 | rules: |
| 72 | - if: $CI_COMMIT_TAG |
| 73 | needs: |
| 74 | - build |
| 75 | script: |
| 76 | - echo "Publishing release $CI_COMMIT_TAG" |
| 77 | release: |
| 78 | tag_name: $CI_COMMIT_TAG |
| 79 | name: "$CI_COMMIT_TAG" |
| 80 | description: "Download the signed APK from the assets section below." |
| 81 | assets: |
| 82 | links: |
| 83 | - name: "ai-chat-android-auto-$CI_COMMIT_TAG.apk" |
| 84 | url: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/apk/${CI_COMMIT_TAG}/ai-chat-android-auto-${CI_COMMIT_TAG}.apk" |
| 85 | link_type: package |