auto-upload-notification

Use the business time to write this automatic upload test package tool, is currently written using NodeJS, write this purpose has two, to solve every time package upload in the send to fly book, very troublesome, use this program can configure once, every time can save trouble; The second is to learn knowledge. Writing projects is one of the best ways to learn.

  • Version 1.0 content

  • Support android platform package, manually configured to run scripts.

  • Support Android upload to Dandelion

  • Support android notification to the corresponding test group

  • Support iOS upload to Dandelion

  • Supports iOS notification to corresponding test groups

  • Version 2.0

  • New configuration project address, so that execution can be done anywhere, without the need to get under the project

  • Support to send to nails

The following are the relevant instructions and explanations for the current version (1.0)

It must be packaged under the Android project.

  1. The script property, which Android must specify to execute the script, is the script property in the auto-. json file. IOS is packaged using tools, so if it’s just iOS, you don’t need to specify it.

  2. The platform attribute (array), which represents the platform, currently has the following values. If you want to specify multiple values at the same time, you can use [“android”, “ios”] :

    • Android only supports Android, and others are automatically masked

    • IOS Only iOS uploads are supported

    • All is supported on all platforms, currently both Android and ios

  3. Pgyer attribute, dandelion related configuration:

  • Upload attribute, the configuration here is the same as dandelion official website upload interface,Upload the appExcept for the file attribute, which is not required to be filled in here, the application will automatically fetch the corresponding package according to the packageDir attribute, which is described below. Among them_api_keyYou only need to click on the upload app to getUpload the App.
  1. The packageDir attribute represents the file path of the package, such as app/build/outputs/apk/. The program will use the specified path to find the file. If there are folders below the specified path, it will recursively search and select the latest installation package.

  2. The feISHU property, which configures the configuration associated with flying books, has the following properties:

  • The title property, which represents the title after it is sent.

  • Message attribute (array), which represents the format of sending messages, that is, to support custom message format. The program uses the rich text of flying books, and the app-related attributes that can be displayed are returned after uploading, in the following format:

{
    "buildKey": "Build Key is the index ID that uniquely identifies the application."."buildType": "Type of app (1:iOS; 2: Android)"."buildIsFirst": "Is it the first App (1: yes; 2: no)"."buildIsLastest": "Is it the latest version (1: yes; 2: no)"."buildFileName": "Application Name"."buildFileSize": "App file size"."buildName": "Application Name"."buildVersion": "Version number. The default version number is 1.0 (used to advertise the application to users, for example, 1.1, 8.2.1, etc.). "."buildVersionNo": "The Version number of the package to be uploaded. The default Version number is 1. For iOS, it's a string; Is an integer for Android. For example: 1001,28, etc.) "."buildBuildVersion": "Build number generated by dandelion to distinguish historical versions"."buildIdentifier": "App package name, BundleId for iOS, package name for Android"."buildIcon": "Application Icon Icon key, visit the address https://www.pgyer.com/image/view/app_icons/ / application Icon Icon key"."buildDescription": "Application Introduction"."buildUpdateDescription": "Application Update Instructions"."buildScreenshots": "Access the address https://www.pgyer.com/image/view/app_screenshots/ application capture key, [application capture key]"."buildShortcutUrl": "Apply short links"."buildCreated": "Application Upload Time"."buildUpdated": "Application Update Time"."buildQRCodeURL":"Application QR code address",}Copy the code

${name}v${version} if we want to display the app name and version number, we can use the test app name: ${name}v${version}. The final display will be: Test app name: test V1.0.

Each element of this property represents a line. The rule here is to remove build, and the first letter can be either uppercase or lowercase, as in:

[
    "Application name: ${name}"."Version number: ${version}"."${type}"."${updated}"."Download qr code:"."${QRCodeURL}"
]
Copy the code

The display looks like this:

The qr code can only occupy a single line, that is, “${QRCodeURL}” above, and the QR code in message can only occupy a single line. If you want to customize the message format, use the Customize attribute.

  • Customize attribute, the purpose of this attribute is for those who want to customize the message, the specific format of feibook website information, which needs to change the two-dimensional code attribute intoQRCodeURLProperty, so you can get the QR code, it doesn’t support other photos,Fly book information.
  • Webhook attribute, also known as flying book robot, please refer to the official website of flying book for the operation process of adding custom robot guide.
  • App_id attribute. If the QR code needs to be displayed, you need to configure this attribute, which can be viewed in the application.
  • App_secret property, same as above.

Because sometimes the name after packaging is not fixed, so I use the way of specifying the folder to upload, it will automatically take the folder under the creation time of the latest file.

Here’s how it looks:

Common Mistakes

  1. It is not implemented under the project.
events.js:292
      throw er; // Unhandled 'error' event
      ^

Error: spawn ./gradlew ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:269:19)
    at onErrorNT (internal/child_process.js:465:16)
    at processTicksAndRejections (internal/process/task_queues.js:80:21)
Emitted 'error' event on ChildProcess instance at:
    at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
    at onErrorNT (internal/child_process.js:465:16)
    at processTicksAndRejections (internal/process/task_queues.js:80:21) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'spawn ./gradlew',
  path: './gradlew',
  spawnargs: [ 'assemblePreviewRelease', '-Penvironment=perView' ]
}
Copy the code

The./gradlew script could not be found, possibly because it is executed in a place other than the project.