android-scripts/enterprise-release-publisher
Florian Schrofner 73e1c71812
support build types and product flavors
2024-02-21 19:14:37 +01:00
..
erp.clj support build types and product flavors 2024-02-21 19:14:37 +01:00
readme.md fix enterprise release publisher upload issues, add flag to skip build phase 2024-02-06 16:17:22 +01:00

readme.md

Enterprise Release Publisher

A script that reads the configuration file in your Android project, builds the defined module/variant combination and then uploads it to the specified server using the defined file name and also updates the JSON file on the remote with the same file name.

Configuration

To use the script for your project, you have to add a configuration file called enterprise-releases.json in the root of your project directory. This file can contain multiple release configurations and needs to specify a couple of key values:

{
    "DEV": {
        "module": "app",
        "variant": "debug",
        "user": "www",
        "server": "sftp://127.0.0.1",
        "path": "/var/www/apps/projects/test",
        "fileName": "Enterprise-Test",
        "gitTag": {
            "format": "ent/v%d",
            "arguments": ["versionCode"]
        }
    },
    "INT": {
        "module": "app",
        "variant": "release",
        "user": "www",
        "server": "sftp://127.0.0.1",
        "path": "/var/www/apps/projects/test",
        "fileName": "Enterprise-Test"
    }
}
  • module: Specifies the module built with Gradle.
  • variant: The variant that should be built. It's combined with the module from above to create the proper Gradle command, e.g. :app:assembleDebug.
  • server: The server (including protocol) to upload the files to.
  • user: The user (which will be passed to curl) to use for the server.
  • path: The path on the remote server where the files should be placed.
  • fileName: The name to be used for the apk & json files on the remote.
  • gitTag: Optional object specifying the format of git tags that should be created automatically.
    • format: A string specifying the tag format. Uses classic Java formatting of strings.
    • arguments: Arguments supplied to the format string. You can use versionCode and/or versionName here. (Theoretically it could be any value inside the elements key from the output-metadata.json file generated by the Gradle build.)

If there's only one release configuration defined, it will automatically pick that one. In case there are multiple configurations you have to add the configuration name you want to build & upload as argument (see examples below).

Example Usage

Simply execute the script in the root directory of your project, optionally specifying the configuration to use if there are multiple.

erp.clj
erp.clj "INT"

If you do not want to rebuild your project and just upload the currently built apk, you can use the --skip-build or -s flag to skip the build phase.

erp.clj --skip-build
erp.clj -s "INT"

SSH Configuration

I'm assuming that you've properly defined your credentials in ~/.ssh/config. Unfortunately curl does not pick up the users defined inside that file, so the actual user still has to be specified inside enterprise-releases.json.

Host SERVER
     IdentityFile PATH_TO_KEY

Fish

If you don't want to add the script itself to your path you can also create a fish function to use it from any directory.

function erp
    PATH_TO_SCRIPT/erp.clj $argv
end

funcsave erp