Gitlab Android 打包 Pipeline 配置

该文描述了如何创建一个Dockerfile来构建包含AndroidSDK、FlutterSDK和CMake的静态CI构建镜像。此外,还展示了.gitlab-ci.yaml文件的配置,用于在GitLab中执行环境设置、构建和部署阶段的CI/CD流程。这个流程包括更新Docker镜像、编译Debug和Release包,并基于推送事件和发布变量决定何时部署。

依赖的 Dockerfile

在根目录下创建 Dockerfile 文件和 .gitlab-ci.yaml 文件,并复制以下内容到 Dockerfile

# This Dockerfile creates a static build image for CI

FROM openjdk:11-jdk

# Just matched `app/build.gradle`
ENV ANDROID_COMPILE_SDK "33"
# Just matched `app/build.gradle`
ENV ANDROID_BUILD_TOOLS "33.0.2"
# Just matched `app/build.gradle`
ENV ANDROID_NDK_VERSION "21.1.6352462"
# Version from https://developer.android.com/studio
ENV ANDROID_COMMAND_LINE_TOOLS "commandlinetools-linux-9477386_latest.zip"
# Flutter SDK Version
ENV FLUTTER_SDK_VERSION "3.7.12"
# CMAKE Version
ENV CMAKE_VERSION "3.10.2.4988404"

ENV ANDROID_HOME $PWD/android-sdk-linux/sdk
ENV PATH="${PATH}:${ANDROID_HOME}/platform-tools/:$PWD/flutter/bin/"

# install OS packages
RUN echo "deb https://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse\ndeb-src https://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse\ndeb https://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse\ndeb-src https://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse\ndeb https://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse\ndeb-src https://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse\ndeb https://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse\ndeb-src https://mirr
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值