V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
owwlo
V2EX  ›  Android

github 上 android 项目,有 CI 工具可以自动编译 apk 并上传到 release 里面么

  •  
  •   owwlo · 2021-04-21 10:13:55 +08:00 · 4960 次点击
    这是一个创建于 1072 天前的主题,其中的信息可能已经有所发展或是发生改变。

    自己的一个小安卓项目,想在 github 上集成 ci 并在 commit 时自动编译并发布 apk 。有什么可靠的方法么?

    在 github marketplace 上搜到了一些,但是不知道哪个坑比较少。有人做过类似的么?

    第 1 条附言  ·  2021-04-21 11:01:54 +08:00
    不好意思写的时候没有写清楚,其实想问有没有什么现成开源 /别人做过的 CI 配置脚本 T T
    11 条回复    2021-05-25 10:49:44 +08:00
    duduaba
        1
    duduaba  
       2021-04-21 10:28:04 +08:00   ❤️ 1
    Travis 、Appveyor
    ch2
        2
    ch2  
       2021-04-21 10:40:51 +08:00   ❤️ 1
    github action 就能搞定,你自己写个 docker 然后指定 action 使用你的 docker 编译 apk
    janus77
        3
    janus77  
       2021-04-21 10:48:10 +08:00 via iPhone   ❤️ 1
    好像自带 action 就可以吧
    AoEiuV020
        4
    AoEiuV020  
       2021-04-21 11:01:08 +08:00   ❤️ 1
    actions 做过,这个是 flutter, 不过道理一样,
    https://github.com/AoEiuV020/FlutterDemo/blob/master/.github/workflows/main.yml
    owwlo
        5
    owwlo  
    OP
       2021-04-21 11:01:45 +08:00
    @ch2 @coderfuns @janus77 , 不好意思写的时候没有写清楚,其实想问有没有什么现成开源 /别人做过的 CI 配置脚本 T T
    mikuazusa
        6
    mikuazusa  
       2021-04-21 11:03:27 +08:00   ❤️ 1
    Jenkins 啥都可以啊
    owwlo
        7
    owwlo  
    OP
       2021-04-21 11:03:53 +08:00
    @AoEiuV020 谢谢!
    Mitt
        8
    Mitt  
       2021-04-21 11:04:58 +08:00   ❤️ 1
    2bab
        9
    2bab  
       2021-04-21 15:03:26 +08:00 via iPhone   ❤️ 1
    搜了下这个好像不错,Action 版本的
    https://github.com/softprops/action-gh-release

    很早的时候我试用过另外一个 Action 版本的 release 脚本,测试了三次没成功,这个 CI 环境调试起来也很麻烦。。就转 Gradle 实现了:

    https://github.com/2BAB/Seal/blob/master/seal/buildSrc/src/main/kotlin/github-release.gradle.kts

    基于 com.github.breadmoirai:github-release:2.2.12 包成了自己方便用的脚本。
    siweipancc
        10
    siweipancc  
       2021-04-22 13:45:22 +08:00 via iPhone
    私人 action 小心账单,其他没啥子
    owwlo
        11
    owwlo  
    OP
       2021-05-25 10:49:44 +08:00
    昨天参照上面大家给的例子外加自己的需求,写了一个简单的 GitHub Actions Workflow,分享在这,希望可以帮到有类似需求的人。

    https://github.com/owwlo/android-github-actions-build-release-demo

    [特性]
    - 根据内嵌在 commit 信息里的 hashtag 来控制是否启动 CI 并编译发布 APK
    - 整个 Workflow 只有 Yaml 和 Python 两种语言构成,足够的简单
    - 根据历史 commit 信息自动生成 Changelog

    另外感谢这个帖子里所有的人,你们的信息对我制作上面这个 workflow 帮助很大。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   953 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 21:18 · PVG 05:18 · LAX 14:18 · JFK 17:18
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.