mirror of
https://gitlab.com/futo-org/fcast.git
synced 2025-07-30 22:07:01 +00:00
Android: Updated CI infrastructure
This commit is contained in:
parent
7a507b0204
commit
a164914ca2
3 changed files with 60 additions and 36 deletions
|
@ -1,7 +1,44 @@
|
||||||
buildAndDeployAndroid:
|
|
||||||
stage: buildAndDeployAndroid
|
buildAndroidDockerContainer:
|
||||||
|
stage: buildDockerContainers
|
||||||
|
image: docker:20.10.16
|
||||||
|
services:
|
||||||
|
- docker:20.10.16-dind
|
||||||
|
tags:
|
||||||
|
- fcast-instance-runner
|
||||||
before_script:
|
before_script:
|
||||||
- cd receivers/android
|
- cd receivers/android
|
||||||
script:
|
script:
|
||||||
- sh deploy.sh
|
- echo "$CI_REGISTRY_PASSWORD" | docker login $CI_REGISTRY -u $CI_REGISTRY_USER --password-stdin
|
||||||
when: manual
|
- docker build -t $CI_REGISTRY/videostreaming/fcast/receiver-android-dev:latest .
|
||||||
|
- docker push $CI_REGISTRY/videostreaming/fcast/receiver-android-dev:latest
|
||||||
|
when: manual
|
||||||
|
|
||||||
|
buildAndDeployAndroid:
|
||||||
|
stage: buildAndDeployAndroid
|
||||||
|
image: gitlab.futo.org:5050/videostreaming/fcast/receiver-android-dev:latest
|
||||||
|
tags:
|
||||||
|
- fcast-instance-runner
|
||||||
|
variables:
|
||||||
|
ANDROID_VERSION_NAME: "1"
|
||||||
|
ANDROID_VERSION_CODE: "1"
|
||||||
|
before_script:
|
||||||
|
- cd receivers/android
|
||||||
|
script:
|
||||||
|
- echo "Building content..."
|
||||||
|
- ./gradlew --stacktrace assembleRelease -PversionName=$ANDROID_VERSION_NAME -PversionCode=$ANDROID_VERSION_CODE
|
||||||
|
- ./gradlew --stacktrace bundlePlaystoreRelease -PversionName=$ANDROID_VERSION_NAME -PversionCode=$ANDROID_VERSION_CODE
|
||||||
|
- echo $ANDROID_VERSION_CODE > ./fcast-version.txt
|
||||||
|
- mkdir /artifacts/$ANDROID_VERSION_CODE
|
||||||
|
- cp -rf out/make/app/defaultFlavor/release/app-defaultFlavor-release.apk /artifacts/$ANDROID_VERSION_CODE/fcast-release.apk
|
||||||
|
- cp -rf out/make/app/playstore/release/app-playstore-release.aab /artifacts/$ANDROID_VERSION_CODE/fcast-playstore-release.aab
|
||||||
|
- cp -rf ./fcast-version.txt /artifacts/fcast-version.txt
|
||||||
|
artifacts:
|
||||||
|
untracked: false
|
||||||
|
when: on_success
|
||||||
|
access: all
|
||||||
|
expire_in: "30 days"
|
||||||
|
paths:
|
||||||
|
- /artifacts/$ANDROID_VERSION_CODE/fcast-release.apk
|
||||||
|
- /artifacts/$ANDROID_VERSION_CODE/fcast-playstore-release.aab
|
||||||
|
when: manual
|
||||||
|
|
19
receivers/android/Dockerfile
Normal file
19
receivers/android/Dockerfile
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
FROM ubuntu:24.04
|
||||||
|
|
||||||
|
# TZ
|
||||||
|
ARG DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
|
ENV ANDROID_HOME=/Android/Sdk
|
||||||
|
ENV TZ=Etc/UTC
|
||||||
|
|
||||||
|
RUN apt update
|
||||||
|
RUN apt install -y zip wget tzdata
|
||||||
|
|
||||||
|
RUN apt install -y openjdk-21-jdk
|
||||||
|
RUN wget https://dl.google.com/android/repository/commandlinetools-linux-13114758_latest.zip
|
||||||
|
RUN unzip commandlinetools-linux-13114758_latest.zip
|
||||||
|
RUN mkdir -p $ANDROID_HOME
|
||||||
|
RUN mv /cmdline-tools $ANDROID_HOME
|
||||||
|
|
||||||
|
RUN yes | $ANDROID_HOME/cmdline-tools/bin/sdkmanager --sdk_root=$ANDROID_HOME --licenses
|
||||||
|
RUN $ANDROID_HOME/cmdline-tools/bin/sdkmanager --sdk_root=$ANDROID_HOME --install "platforms;android-36"
|
|
@ -1,32 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
if [ -z "$ANDROID_VERSION_NAME" ] || [ -z "$ANDROID_VERSION_CODE" ]; then echo "Version name or code not specified. Skipping build."; exit 0; fi
|
|
||||||
|
|
||||||
DOCUMENT_ROOT=/var/www/html
|
|
||||||
|
|
||||||
# Build content
|
|
||||||
echo "Building content..."
|
|
||||||
./gradlew --stacktrace assembleRelease -PversionName=$ANDROID_VERSION_NAME -PversionCode=$ANDROID_VERSION_CODE
|
|
||||||
./gradlew --stacktrace bundlePlaystoreRelease -PversionName=$ANDROID_VERSION_NAME -PversionCode=$ANDROID_VERSION_CODE
|
|
||||||
|
|
||||||
# Take site offline
|
|
||||||
echo "Taking site offline..."
|
|
||||||
touch $DOCUMENT_ROOT/maintenance.file
|
|
||||||
|
|
||||||
# Swap over the content
|
|
||||||
echo "Deploying content..."
|
|
||||||
echo $ANDROID_VERSION_CODE > /var/www/html/fcast-version.txt
|
|
||||||
cp ./app/build/outputs/apk/defaultFlavor/release/app-defaultFlavor-release.apk /var/www/html/fcast-release.apk
|
|
||||||
cp ./app/build/outputs/bundle/playstoreRelease/app-playstore-release.aab /var/www/html/fcast-playstore-release.aab
|
|
||||||
|
|
||||||
# Notify Cloudflare to wipe the CDN cache
|
|
||||||
echo "Purging Cloudflare cache..."
|
|
||||||
curl -X POST "https://api.cloudflare.com/client/v4/zones/ff904f7348b9513064b23e852e328abb/purge_cache" \
|
|
||||||
-H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
|
|
||||||
-H "Content-Type: application/json" \
|
|
||||||
--data '{"purge_everything":true}'
|
|
||||||
|
|
||||||
sleep 30
|
|
||||||
|
|
||||||
# Take site back online
|
|
||||||
echo "Bringing site back online..."
|
|
||||||
rm $DOCUMENT_ROOT/maintenance.file
|
|
Loading…
Add table
Add a link
Reference in a new issue