Skip to content

Android CI

Android CI #6

Workflow file for this run

name: Android CI
on:
workflow_dispatch:
inputs:
docker_images:
description: '请填写docker镜像名称 多个用英文逗号分开'
required: true
default: 'alpine:latest' # 设置默认的 Docker 镜像列表
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: gradle
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew assembleRelease
# Step 6: Generate Keystore using keytool
- name: Generate Keystore
run: |
keytool -genkey -v -keystore my-release-key.jks -keyalg RSA -keysize 2048 -validity 10000 \
-alias my-key-alias -storepass android -keypass android \
-dname "CN=Example, OU=Dev, O=MyCompany, L=City, ST=State, C=US"
- name: Sign Release
uses: r0adkll/sign-android-release@v1
id: sign_app
env:
BUILD_TOOLS_VERSION: "34.0.0"
# Step 7: Sign APK
- name: Sign APK
run: |
jarsigner -verbose -keystore my-release-key.jks -storepass android -keypass android \
app/build/outputs/apk/release/app-arm64-v8a-release-unsigned.apk my-key-alias
zipalign -v 4 app/build/outputs/apk/release/app-arm64-v8a-release-unsigned.apk app/build/outputs/apk/release/app-release.apk
- uses: actions/upload-artifact@v4
with:
name: build-artifact
path: app/build/outputs/apk/release/app-release.apk