Skip to content

Commit

Permalink
🚧 [kmp] daily android publish
Browse files Browse the repository at this point in the history
  • Loading branch information
kingsword09 committed Jul 15, 2024
1 parent 58eb55b commit a86cca9
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 3 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/daily-android-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Daily Android Publish CI

on:
schedule:
- cron: '0 8 * * *' # 每天 UTC 时间 8:00 执行

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: set up JDK 17
- uses: actions/setup-java@v4
with:
distribution: 'corretto'
java-version: 21

- uses: denoland/setup-deno@v1
with:
deno-version: v1.x

- uses: pnpm/action-setup@v4

- name: Dependencis install
run: |
deno task init && deno task dev
15 changes: 12 additions & 3 deletions next/kmp/build-android.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,16 +153,25 @@ const upgradeVersionInfo = async (filePath: string, forceUpdate = false) => {
}
};

enum ANDROID_CHANNEL {
DEV = "dev",
BETA = "beta",
RC = "rc",
STABLE = "stable"
}

if (import.meta.main) {
// 发布版本的时候,升级下版本信息 versionCode和versionName
const version = await upgradeVersionInfo(resolveTo("gradle/libs.versions.toml"), Deno.args.includes("--new"));
const channel = <ANDROID_CHANNEL>cliArgs.channel ?? ANDROID_CHANNEL.STABLE;

// // // 发布版本的时候,升级下版本信息 versionCode和versionName
const version = await upgradeVersionInfo(resolveTo("gradle/libs.versions.toml"), cliArgs.new);
if (cliArgs.clean) {
await doCleanBuildDIR(); // 清空编译目录
}
await doBundle();
const dirpath = await doCopy(version);

const uploadArgs: $UploadReleaseParams = [`android-${version}`, dirpath, "*.apk"];
const uploadArgs: $UploadReleaseParams = [`android-${channel == ANDROID_CHANNEL.STABLE ? "" : `${channel}-`}${version}`, dirpath, "*.apk"];
await recordUploadRelease(uploadArgs[0], uploadArgs);
if (cliArgs.upload) {
await doUploadRelease(...uploadArgs);
Expand Down

0 comments on commit a86cca9

Please sign in to comment.