GithubHelp home page GithubHelp logo

mega-arbuz / apk-release-deploy Goto Github PK

View Code? Open in Web Editor NEW
20.0 5.0 42.0 26 KB

Deploy APK file with changelog for Android projects with CI/CD.

License: Apache License 2.0

Python 100.00%
android ci-cd apk-release continuous-integration continuous-deployment ci cd gitlab-ci

apk-release-deploy's Introduction

APK release and deploy

Deploy APK file with changelog for Android projects with CI/CD. This script uploads the release APK file to Dropbox and sends an email, with download link and changelog.

This script is used in my GitLab CI/CD for Android projects. The process is described in this Medium article and also in my GitHub pages.

Sample project that is using this script for CI/CD https://gitlab.com/arbuz/android-ci-cd.

Motivation

I created this for Gitlab CI, when I had a problem making build/release artifacts public. This script is the last stage for Android CI/CD process and may be helpful in following cases:

  • Early stage projects which are not present in any app market, but need a way of distribution.
  • Enthusiastic CEO who wants to have the latest builds with the latest changes.
  • Freelancer who needs a painless way to distribute his work to clients.
  • Teams that want an easy way to send the app for regression tests.

How does it work

API

This project is using Dropbox for APK storage and Zapier for sending emails. You will need Dropbox API key and Zapier hook URL.

Changes

Changes are extracted from provides CHANGEOG file. Each version change should end with '##' and begin with a title, that starts with '#' char. Example:

# Version 1.05

Removed Google Maps Fragment
Added:
 - Settings crash
 - ANR when loading
##
# Version 1.04

Added Google Maps Fragment
Fixed:
 - Settings crash
 - ANR when loading
##

The script will extract the latest (1.05 in example) changes.

Email template

The script is using email template file for email composing. The template can have placeholders for the following: app name, app version, download link, changes. Example for app name CoolApp, version 1.05:

#subject
New {app_name} release, version {app_version}
#body
New version is available for download:
{app_download_url}

Changes:
{change_log}

This email was sent automatically, please do not reply.

This will compose the following email subject:

New CoolApp release, version 1.05

And email body:

New version is available for download:
https://www.dropbox.com/s/lk2lk321jl1/coolapp_1_05.apk?dl=1

Changes:
Removed Google Maps Fragment
Added:
 - Settings crash
 - ANR when loading

This email was sent automatically, please do not reply.

Usage

Help:

python3 deploy.py -h

Run (all arguments required):

python3 deploy.py \
    --release.dir=app/build/outputs/apk/release \
    --app.name=CoolAppp \
    --dropbox.key=$DROPBOX_KEY \
    --dropbox.folder=build \
    --changelog.file=CHANGELOG \
    --template.file=template_file \
    --zapier.hook=$ZAPIER_HOOK \
    [email protected],[email protected]

apk-release-deploy's People

Contributors

mega-arbuz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

apk-release-deploy's Issues

issue with new gradle version

in the latest version of com.android.tools.build:gradle (3.4.0), the output.json file content is changed. apkInfo changed to apkData which lead to error getting apk info.

error:
Traceback (most recent call last): File "apk-release-deploy/deploy.py", line 249, in <module> app_version, app_file = get_app(options.release_dir) File "apk-release-deploy/deploy.py", line 144, in get_app app_version = json_data[0]['apkInfo']['versionName'] KeyError: 'apkInfo'

sample new content of output.json:

[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":1,"versionName":"1.0","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}]

cant open downloaded apk file

Hi, I read your great article from medium, but I have one problem.

when I download the apk from dropbox url using chrome in android devices(redirected by gmail app), the apk cant be opened, it seems the apk file is not recognized as an APK (altough it has apk extension).

and then I try to download the apk from dropbox url using my chrome on pc browser and transfer it to my android devices. now the apk file can be opened.

this issue maybe related to this: https://stackoverflow.com/questions/3253079/cant-install-apk-from-browser-downloads

can u do something about it? thanks

how to generetae version

hi i want to ask about version, im using flutter for develop the app... i use your script for publish to dropbox and send to email... how to generetate version in app using this code? because on my script always return 1.0.0 ... thank you anway

Failed: get share link from Dropbox 401

First of all thank you so much for sharing your script.

While using your script I am getting an issue like below

Failed: get share link from Dropbox 401
Cleaning up file based variables
ERROR: Job failed: exit code 1

also in dropbox file is saving with below name

bestappever_1_0-null.apk.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.