Application packaging and publishing method, device and system based on automation
By automating the entire application packaging and release process through automated scripts and build toolchains, the system solves the problems of chaotic version management and low efficiency caused by traditional manual operations, improves the reliability and efficiency of build and release, and is suitable for large-scale team collaboration and continuous integration.
Patent Information
- Application Number
- CN202510757074.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-06
- Publication Date
- 2025-10-28
AI Technical Summary
Traditional application packaging and deployment processes rely on manual operations, resulting in chaotic version management, low build efficiency, difficulty in adapting to the requirements of large-scale team collaboration and continuous integration, and a lack of in-depth support for HarmonyOS.
The application uses automated scripts to update the version number information in the application configuration file and the path information in the signing configuration file. It uses a build toolchain to install, clean, and build dependencies, and combines multi-threaded concurrent upload technology to achieve full automation of application packaging and release.
Reduce manual operation time, lower the probability of errors in configuration file modification, improve the reliability and efficiency of the build and release process, and enhance the continuity and integration efficiency of application development.
Smart Images

Figure CN120848936A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of automation technology, and in particular to an application packaging and publishing method, apparatus and system based on automation. Background Art
[0002] With the rapid development of the HarmonyOS ecosystem and the widespread adoption of devices across all scenarios, HarmonyOS application development faces the dual challenges of multi-platform adaptation (mobile phones, tablets, smart wearables, etc.) and efficient deployment. Developers need to frequently package and iterate applications to meet the compatibility requirements of different devices and users' real-time feature updates. Against this backdrop, the application packaging and deployment process places higher demands on development efficiency and stability.
[0003] Traditional development processes rely on manual operations, requiring developers to sequentially complete tasks such as version number modification, signature configuration, dependency installation, building, and uploading. Furthermore, they lack deep support for HarmonyOS, leading to chaotic version management, low build efficiency, and difficulty in meeting the requirements of large-scale team collaboration and continuous integration. Therefore, proposing a technical solution that can automate the entire application packaging and release process, improving the efficiency and reliability of application development, is of paramount importance. Summary of the Invention
[0004] This invention provides an automated application packaging and publishing method, apparatus, and system, which can facilitate the full automation of application packaging and publishing, and improve the efficiency and reliability of application development.
[0005] To address the aforementioned technical problems, the first aspect of this invention discloses an automated application packaging and deployment method, which is applied to an electronic device having a target application running on the HarmonyOS system installed thereon. The method comprises: Obtain the initial information corresponding to the target application and the configuration file of the target application. The initial information includes the initial version number and the initial signature. The configuration file includes the application configuration file and the signature configuration file. Update the version number information in the application configuration file according to the initial version number, and update the path information in the signature configuration file according to the initial signature to obtain the updated target application; Obtain the build toolchain corresponding to the target application, the build toolchain including dependency installation tools, cleanup tools and build tools; The dependency installation tool installs dependency packages for the target application updated to the initial version number, thereby obtaining the target application after dependency installation. The cleanup tool cleans up residual files in the build environment of the target application after dependency installation, thereby obtaining the cleaned target application. The build tool then builds the application package of the cleaned target application. The upload information of the target platform is determined, and the application package is uploaded to the target platform according to the upload information to publish the target application. The upload information includes the upload interface and upload credentials.
[0006] As an optional implementation, in the first aspect of the present invention, the step of updating the version number information in the application configuration file according to the initial version number and updating the path information in the signature configuration file according to the initial signature to obtain the updated target application includes: Extract the version number information from the application configuration file and the path information from the signing configuration file. The version number information includes the current version number field, and the path information includes the signing certificate path field. The current version number field is updated according to the preset version number rules and the initial version number to obtain the updated application configuration file; Determine the environment variables of the target application, and update the signature certificate path field according to the environment variables and the initial signature to obtain the updated signature configuration file; The updated target application is determined based on the updated application configuration file and the updated signature configuration file.
[0007] As an optional implementation, in the first aspect of the present invention, the step of installing dependency packages for the target application according to the updated initial version number using the dependency installation tool includes: Determine the first version information corresponding to the local dependencies of the updated target application and the second version information corresponding to the dependency declaration file of the development environment of the target application; Determine whether the first version information matches the second version information. If the first version information does not match the second version information, install the dependency package for the updated target application using the dependency installation tool, based on the initial version number and the second version information.
[0008] As an optional implementation, in the first aspect of the present invention, the method further includes: Determine the signature verification information of the signature configuration file, wherein the signature verification information includes signature validity period information and signature data chain information; The signature verification information is verified according to the preset signature verification rules to obtain the verification result; When the verification result indicates that the signature verification information is valid, the operation of building the cleaned application package of the target application through the building tool is triggered.
[0009] As an optional implementation, in the first aspect of the present invention, the step of constructing the cleaned application package of the target application using the construction tool includes: The modified files in the cleaned target application are identified using a preset difference recognition tool; The modified files in the target application are incrementally compiled using the build tool to obtain the incremental compilation result, and the updated application package of the target application is built based on the incremental compilation result.
[0010] As an optional implementation, in the first aspect of the present invention, the step of uploading the application package to the target platform for application publishing based on the upload information includes: Determine whether the uploaded credential meets the preset validity conditions. When the uploaded credential meets the validity conditions, establish an encrypted transmission channel according to the upload interface. The application package is segmented to obtain multiple data blocks corresponding to the application package, and each data block is uploaded to the target platform through the encrypted transmission channel in a multi-threaded concurrent manner. For each thread's upload task, monitor the upload progress of that thread's upload task. When the upload progress indicates that the transmission is interrupted, re-execute the thread's upload task based on the exponential backoff algorithm.
[0011] A second aspect of the present invention discloses an automated application packaging and publishing apparatus, the apparatus comprising: The acquisition module is used to acquire the initial information corresponding to the target application and the configuration file of the target application. The initial information includes the initial version number and the initial signature, and the configuration file includes the application configuration file and the signature configuration file. The update module is used to update the version number information in the application configuration file according to the initial version number, and update the path information in the signature configuration file according to the initial signature, so as to obtain the updated target application; The acquisition module is also used to acquire the build toolchain corresponding to the target application, the build toolchain including dependency installation tools, cleanup tools and build tools; The build module is used to install dependency packages for the target application with the updated version number using the dependency installation tool, to obtain the target application after dependency installation, and to clean up residual files in the build environment of the target application after dependency installation using the cleanup tool, to obtain the cleaned target application, and to build the application package of the cleaned target application using the build tool. The first determining module is used to determine the upload information of the target platform, and upload the application package to the target platform to publish the target application according to the upload information. The upload information includes the upload interface and the upload credential.
[0012] As an optional implementation, in a second aspect of the present invention, the update module updates the version number information in the application configuration file according to the initial version number and updates the path information in the signature configuration file according to the initial signature to obtain the updated target application specifically includes: Extract the version number information from the application configuration file and the path information from the signing configuration file. The version number information includes the current version number field, and the path information includes the signing certificate path field. The current version number field is updated according to the preset version number rules and the initial version number to obtain the updated application configuration file; Determine the environment variables of the target application, and update the signature certificate path field according to the environment variables and the initial signature to obtain the updated signature configuration file; The updated target application is determined based on the updated application configuration file and the updated signature configuration file.
[0013] As an optional implementation, in the second aspect of the present invention, the method by which the build module installs dependency packages for the target application according to the updated initial version number using the dependency installation tool specifically includes: Determine the first version information corresponding to the local dependencies of the updated target application and the second version information corresponding to the dependency declaration file of the development environment of the target application; Determine whether the first version information matches the second version information. If the first version information does not match the second version information, install the dependency package for the updated target application using the dependency installation tool, based on the initial version number and the second version information.
[0014] As an optional implementation, in a second aspect of the invention, the apparatus further includes: The second determining module is used to determine the signature verification information of the signature configuration file, wherein the signature verification information includes signature validity period information and signature data chain information; The verification module is used to verify the signature verification information according to the preset signature verification rules and obtain the verification result. When the verification result indicates that the signature verification information is valid, the building module is triggered to perform the operation of building the cleaned application package of the target application through the building tool.
[0015] As an optional implementation, in the second aspect of the present invention, the method by which the construction module constructs the cleaned application package of the target application using the construction tool specifically includes: The modified files in the cleaned target application are identified using a preset difference recognition tool; The modified files in the target application are incrementally compiled using the build tool to obtain the incremental compilation result, and the updated application package of the target application is built based on the incremental compilation result.
[0016] As an optional implementation, in a second aspect of the present invention, the method by which the first determining module uploads the application package to the target platform for application publishing based on the upload information specifically includes: Determine whether the uploaded credential meets the preset validity conditions. When the uploaded credential meets the validity conditions, establish an encrypted transmission channel according to the upload interface. The application package is segmented to obtain multiple data blocks corresponding to the application package, and each data block is uploaded to the target platform through the encrypted transmission channel in a multi-threaded concurrent manner. For each thread's upload task, monitor the upload progress of that thread's upload task. When the upload progress indicates that the transmission is interrupted, re-execute the thread's upload task based on the exponential backoff algorithm.
[0017] A third aspect of the present invention discloses an electronic device, the electronic device comprising: Memory containing executable program code; A processor coupled to the memory; The processor calls the executable program code stored in the memory to execute some or all of the steps in the automated application packaging and publishing method according to any of the first aspects of the present invention.
[0018] The fourth aspect of the present invention discloses a computer storage medium storing computer instructions, which, when invoked, are used to execute some or all of the steps in the automated application packaging and publishing method described in any of the first aspects of the present invention.
[0019] The fifth aspect of the present invention discloses an automated application packaging and publishing system, characterized in that the system includes at least the automated application packaging and publishing device described in any of the second aspects of the present invention, and a network attached storage device communicatively connected to the automated application packaging and publishing device. After the automated application packaging and publishing device completes the application packaging and publishing operation triggered by the developer according to the automated application packaging and publishing method described in any of the first aspects of the present invention, it obtains a target program that works in conjunction with the network attached storage device. or, The system includes at least the electronic device described in the third aspect of the present invention, and a network-attached storage device connected to the electronic device. After the electronic device completes the application packaging and publishing operation triggered by the developer according to any of the automated application packaging and publishing methods described in the first aspect of the present invention, it obtains a target program that works in conjunction with the network-attached storage device.
[0020] Compared with the prior art, the present invention has the following beneficial effects: In this embodiment of the invention, an automated script updates the version number information in the application configuration file based on the initial version number and updates the path information in the signature configuration file based on the initial signature to obtain the updated target application. This reduces manual operation time, lowers the probability of errors caused by manually modifying configuration files, reduces the risk of key leakage, and improves the reliability of the build and release process. The automated script calls the build toolchain to build the application package of the updated target application, determines the upload information of the target platform, and uploads the application package to the target platform for application release based on the upload information. This improves the efficiency and reliability of the build and release process and enhances the continuity of application integration and delivery. Attached Figure Description
[0021] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0022] Figure 1 This is a flowchart illustrating an automated application packaging and publishing method disclosed in an embodiment of the present invention; Figure 2 This is a flowchart illustrating another automated application packaging and publishing method disclosed in an embodiment of the present invention; Figure 3 This is a schematic diagram of the structure of an automated application packaging and publishing device disclosed in an embodiment of the present invention; Figure 4 This is a schematic diagram of another automated application packaging and publishing device disclosed in an embodiment of the present invention; Figure 5 This is a schematic diagram of the structure of an electronic device disclosed in an embodiment of the present invention; Figure 6 This is a schematic diagram of the structure of an automated application packaging and publishing system disclosed in an embodiment of the present invention; Figure 7 This is a schematic diagram of another automated application packaging and publishing system disclosed in an embodiment of the present invention. Detailed Implementation
[0023] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0024] The terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this invention are used to distinguish different objects, not to describe a specific order. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, apparatus, product, or end that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products, or ends.
[0025] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of the invention. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0026] This invention discloses an automated application packaging and deployment method, apparatus, and system, which can reduce manual operation time, decrease the probability of errors caused by manually modifying configuration files, reduce the risk of key leakage, improve the efficiency and reliability of the build and deployment process, and enhance the continuity of application integration and delivery. These are described in detail below.
[0027] Example 1 Please see Figure 1 , Figure 1 This is a flowchart illustrating an automated application packaging and deployment method disclosed in an embodiment of the present invention. Figure 1 The described automated application packaging and deployment method can be applied to electronic devices that have target applications running on the HarmonyOS system installed. It can also be applied to automated application packaging and deployment devices that can communicate with network-attached storage devices. These devices may include intelligent servers or intelligent platforms for packaging and deploying HarmonyOS applications. The intelligent server may include a NAS server or a cloud server; however, this embodiment of the invention is not limited to these specific methods. Figure 1 As shown, this automated application packaging and deployment method may include the following operations: 101. Obtain the initial information and configuration file of the target application.
[0028] In this embodiment of the invention, optionally, the packaging and publishing operations of the target application can be completed based on an automated script module. Specifically, this may include version number modification, signature configuration, dependency installation, project cleanup, application building, and upload and publishing operations. Seamless collaborative building between the Flutter module and the HarmonyOS native environment can be achieved based on a network attached storage device. Specifically, components such as the Flutter SDK and Dart dependencies can be hosted on the cloud of the network attached storage device. When building the application package of the target application, the automated script module automatically pulls the version compatible with the current HarmonyOS project, avoiding compilation failures caused by local environment differences.
[0029] In this embodiment of the invention, optionally, the target application may include a HarmonyOS application, that is, an application developed based on the HarmonyOS development environment. The initial information corresponding to the target application may include an initial version number and an initial signature. Specifically, the initial version number of the target application may be uploaded by the user and can be obtained through script parameters or interactive input. The configuration file of the target application may include an application configuration file and a signature configuration file. The application configuration file (app.json5) is used to store basic information of the application, such as version number, application name, etc., and the signature configuration file (build-profile.json5) is used to store the build configuration information of the application, such as signature certificate path, build mode, etc. This invention does not limit the scope of the application.
[0030] 102. Update the version number information in the application configuration file according to the initial version number, and update the path information in the signature configuration file according to the initial signature to obtain the updated target application.
[0031] Optionally, in this embodiment of the invention, the version number information in the application configuration file can be updated according to the initial version number, that is, the versionCode field in the application configuration file (app.json5 file) can be read, and then the jq tool can be used to update the versionCode field according to the initial version number; or the path information in the signature configuration file can be updated according to the initial signature, that is, the path information in the signature configuration file (build-profile.json5 file) can be read, and then the sed command can be used to replace the signature certificate path in the signature configuration file according to the signature, and then the updated target application can be obtained based on the updated application configuration file and the signature configuration file. This invention does not limit the scope of the invention.
[0032] In this embodiment of the invention, optionally, after the Flutter module is packaged, a semantic version number (e.g., 1.0.0-login-beta) can be automatically generated based on the Git branch name (e.g., feature / login) and written to pubspec.yaml and the HarmonyOS project's build.gradle, ensuring that testers can accurately trace the source of the component.
[0033] In this embodiment of the invention, optionally, in Debug mode, a hidden panel can be triggered by a shake gesture or ADB command to display the Git commit hash, branch, and cloud compilation timestamp of the current Flutter module in real time, which facilitates rapid verification of functional consistency during the development phase.
[0034] In this embodiment of the invention, optionally, / tmp / build.log can be used to record the execution status (success / failure / time taken) of each step. If a step fails, it will automatically roll back to the previous successful state.
[0035] 103. Obtain the build toolchain corresponding to the target application.
[0036] In this embodiment of the invention, optionally, the build toolchain corresponding to the target application may include the HarmonyOS development toolchain. Specifically, the build toolchain corresponding to the target application may include dependency installation tools, cleanup tools, and build tools, such as the ohpm tool and the hvigor tool. Here, the ohpm tool represents the HarmonyOS package management tool, which is used to install project dependencies, and the hvigor tool represents the HarmonyOS build tool, which is used to perform project cleanup and build operations. This invention does not impose any limitations.
[0037] 104. Using a dependency installation tool, install the dependency packages for the updated target application according to the initial version number to obtain the target application after dependency installation. Then, using a cleanup tool, clean up the residual files in the build environment of the target application after dependency installation to obtain the cleaned target application. Finally, using a build tool, build the application package of the cleaned target application.
[0038] In this embodiment of the invention, optionally, an automated script can be used to call the HarmonyOS development toolchain in the HarmonyOS development environment to perform dependency installation, project cleanup, and application build operations on the updated target application, thereby building the application package of the updated target application. Specifically: Dependency installation tools can be used to install dependencies for the updated target application based on the initial version number. Specifically, the `ohpm install` command can be executed in the project directory to install matching dependencies for the application. Cleanup tools can be used to clean up residual files in the build environment of the updated target application. Specifically, the `hvigor clean` command can be executed to clean up residual files and prevent them from affecting the build results. Build tools can be used to build the application package of the updated target application. Specifically, the `hvigor assembleApp` command can be executed, specifying the build mode as release, to build the application package of the updated target application. This invention is not limited to these methods.
[0039] 105. Determine the upload information for the target platform, and upload the application package to the target platform to publish the target application based on the upload information.
[0040] In this embodiment of the invention, optionally, the target platform may include Huawei AppGallery Connect. Determining the upload information of the target platform may specifically include: calling the API of Huawei AppGallery Connect via an HTTP request to obtain upload information, which may include the upload interface and upload credentials; the automated script module uploads the application package to the target platform for application release based on the upload information, which is not limited in this invention.
[0041] It is evident that implementation Figure 1 The described automated application packaging and deployment method can obtain the initial information and configuration file of the target application, update the version number information in the application configuration file according to the initial version number, and update the path information in the signature configuration file according to the initial signature to obtain the updated target application. Using a dependency installation tool, it installs dependency packages for the updated target application according to the initial version number, resulting in a dependency-installed target application. Using a cleanup tool, it cleans up residual files in the build environment of the dependency-installed target application, resulting in a cleaned target application. Finally, using a build tool, it builds the application package of the cleaned target application. It can automatically perform dependency installation, project cleanup, and project build operations on the target application by calling relevant toolchains through automated scripts, improving the overall efficiency and reliability of project build and packaging. It determines the upload information of the target platform and uploads the application package to the target platform for application deployment based on the upload information. It can automatically modify the project version number and configuration signature based on automated scripts to build the application for automated packaging and deployment operations, reducing operational error rates, improving the efficiency and reliability of application development, and enhancing the continuity of application integration and delivery.
[0042] In an optional embodiment, installing dependency packages for the updated target application based on the initial version number using a dependency installation tool may include the following operations: Determine the first version information corresponding to the local dependencies of the updated target application and the second version information corresponding to the dependency declaration file of the target application's development environment; Determine if the first version information matches the second version information. If the first version information does not match the second version information, use the dependency installation tool to install the dependency package for the updated target application based on the initial version number and the second version information.
[0043] In this optional embodiment, optionally, before installing dependencies, i.e. before executing the ohpm install command, the first version information corresponding to the local dependencies of the updated target application and the second version information corresponding to the dependency declaration file of the target application's development environment can be determined, and it can be determined whether the first version information and the second version information match. That is, the script automatically detects the compatibility between the local dependency version and oh-package.json5. When the first version information and the second version information do not match, the dependency installation tool installs the dependency package for the updated target application according to the initial version number and the second version information. That is, when the local dependency version conflicts with oh-package.json5, the dependency version that matches oh-package.json5 is downloaded first. This embodiment does not limit this.
[0044] As can be seen, implementing this optional embodiment can determine the first version information corresponding to the local dependencies of the updated target application and the second version information corresponding to the dependency declaration file of the target application's development environment, determine whether the first version information and the second version information match, and when the first version information and the second version information do not match, install the dependency package for the updated target application by using the dependency installation tool according to the initial version number and the second version information. It can improve the accuracy and reliability of dependency installation operations by detecting the compatibility between local dependencies and dependency declaration files, and improve the compatibility between installed dependencies and the project development environment.
[0045] In another alternative embodiment, the automated application packaging and deployment method may further include the following operations: Determine the signature verification information in the signature configuration file. The signature verification information includes signature validity period information and signature data chain information. The signature verification information is verified according to the preset signature verification rules to obtain the verification result; When the verification result indicates that the signature verification information is valid, the operation of building the cleaned application package of the target application through the build tool is triggered.
[0046] In this optional embodiment, optionally, before building the application, i.e. before executing the hvigor assembleApp command, the signature verification information of the signature configuration file can be determined by an automated script module. The signature verification information may include signature validity period information and signature data chain information. Then, the signature verification information is verified according to preset signature verification rules to obtain the verification result. The signature verification rules may include signature validity period verification rules and signature integrity verification rules. Specifically, the signature validity period information of the signature configuration file can be verified to be valid according to the signature validity period verification rules, and the signature data chain information of the signature configuration file can be verified to be complete according to the signature integrity verification rules. This embodiment does not limit this.
[0047] In this optional embodiment, the verification result indicating that the signature verification information is valid may include the validity of the signature validity period information of the signature configuration file and the completeness of the signature data chain information of the signature configuration file. At this time, the operation of building the updated application package of the target application through the build tool can be triggered. When the verification result indicates that the signature verification information is invalid, the signature configuration can be automatically modified by an automated script, or the user can be notified to check the signature configuration file. This embodiment does not impose any limitations.
[0048] As can be seen, implementing this optional embodiment can determine the signature verification information of the signature configuration file. The signature verification information includes signature validity period information and signature data chain information. The signature verification information is verified according to the preset signature verification rules to obtain the verification result. When the verification result indicates that the signature verification information is valid, the operation of building the updated target application package through the build tool is triggered. This can verify the validity of the application signature information before building the application, reduce the application signature error rate, and improve the accuracy and security of application building.
[0049] In yet another alternative embodiment, building the cleaned target application package using a build tool may include the following operations: The pre-set difference identification tool identifies modified files in the cleaned target application; The modified files in the target application are incrementally compiled using a build tool to obtain the incremental compilation results, and the updated application package of the target application is built based on the incremental compilation results.
[0050] In this optional embodiment, the modified files in the updated target application can be identified by a preset diff identification tool. Specifically, the modified files in the updated target application can be identified by git diff, and then the modified files in the target application can be incrementally compiled by the build tool, skipping the unchanged dependencies, thereby obtaining the incremental compilation result, and the application package of the updated target application can be built according to the incremental compilation result. This embodiment does not limit this.
[0051] As can be seen, implementing this optional embodiment can identify modified files in the updated target application through a preset difference identification tool, incrementally compile the modified files in the target application through a build tool to obtain incremental compilation results, and build the application package of the updated target application based on the incremental compilation results. Only modified files are compiled, skipping unchanged dependencies, shortening application build time and improving application build efficiency.
[0052] In yet another optional embodiment, uploading the application package to the target platform for application publishing based on the uploaded information may include the following operations: Determine whether the uploaded credentials meet the preset validity conditions. When the uploaded credentials meet the validity conditions, establish an encrypted transmission channel based on the upload interface. The application package is segmented into multiple data blocks corresponding to the application package, and each data block is uploaded to the target platform through an encrypted transmission channel using a multi-threaded concurrent approach. For each thread's upload task, monitor the upload progress of that thread's upload task. When the upload progress indicates that the transmission is interrupted, re-execute the upload task of that thread based on the exponential backoff algorithm.
[0053] In this optional embodiment, before uploading the application package to the target platform for application release based on the upload information, an output directory can be created, and then the application package can be copied to the output directory using the cp command for centralized management of the application package. This embodiment does not limit this.
[0054] In this optional embodiment, it can be determined whether the uploaded credentials meet the preset validity conditions, i.e., the legality of the uploaded credentials. When the uploaded credentials meet the validity conditions, an encrypted transmission channel is established according to the upload interface, the application package is segmented into multiple data blocks corresponding to the application package, and each data block is uploaded to the target platform through the encrypted transmission channel in a multi-threaded concurrent manner. Each thread is used to upload at least one data block. For each thread's upload task, the upload progress of the thread's upload task is monitored. When the upload progress indicates that the transmission is interrupted, the thread's upload task can be re-executed based on the exponential backoff algorithm. After the application package upload and release operation is completed, an application release log can be generated and saved. This embodiment does not impose any limitations.
[0055] As can be seen, implementing this optional embodiment can determine whether the uploaded credentials meet the preset validity conditions. When the uploaded credentials meet the validity conditions, an encrypted transmission channel is established according to the upload interface, the application package is segmented into multiple data blocks corresponding to the application package, and each data block is uploaded to the target platform through the encrypted transmission channel in a multi-threaded concurrent manner. For each thread's upload task, the upload progress of the thread's upload task is monitored. When the upload progress indicates that the transmission is interrupted, the upload task of the thread is re-executed based on the exponential backoff algorithm. This can improve the security and efficiency of application package upload, thereby improving the efficiency of application release.
[0056] Example 2 Please see Figure 2 , Figure 2 This is a flowchart illustrating an automated application packaging and deployment method disclosed in an embodiment of the present invention. Figure 2 The described automated application packaging and deployment method can be applied to electronic devices that have applications running on the HarmonyOS system installed, and can also be applied to automated application packaging and deployment devices that can communicate with network-attached storage devices. These devices may include intelligent servers or intelligent platforms for packaging and deploying HarmonyOS applications. The intelligent server may include a NAS server or a cloud server; however, this embodiment of the invention is not limited to these specific methods. Figure 2 As shown, this automated application packaging and deployment method may include the following operations: 201. Obtain the initial information and configuration file of the target application.
[0057] 202. Extract the version number information from the application configuration file and the path information from the signature configuration file.
[0058] In this embodiment of the invention, optionally, the version number information in the application configuration file (app.json5 file) can be extracted by an automated script module. The version number information may include the current version number field, i.e., the versionCode field. The path information in the signing configuration file (build-profile.json5 file) can be extracted by an automated script module. The path information includes the signing certificate path field. This invention does not limit the scope of the invention.
[0059] 203. Update the current version number field according to the preset version number rules and the initial version number to obtain the updated application configuration file.
[0060] In this embodiment of the invention, optionally, the preset version number rule represents the version number rule in the current HarmonyOS application. Specifically, it may include one or more combinations of version number naming rules, version number update rules, and version number verification rules. The jq tool can be used to update the versionCode field according to the version number rule and the initial version number to obtain the updated application configuration file. This invention does not limit this.
[0061] 204. Determine the environment variables of the target application, update the signing certificate path field based on the environment variables and the initial signature, and obtain the updated signing configuration file.
[0062] In this embodiment of the invention, optionally, the environment variables of the target application can represent the environment scalar of the development environment of the target application, specifically the environment variables of the HarmonyOS development environment. The sed command can be used to replace the signature certificate path field in the signature configuration file according to the environment variables and the initial signature to obtain the updated signature configuration file, so that the updated signature certificate path field matches the HarmonyOS development environment. This invention does not limit this.
[0063] 205. Determine the updated target application based on the updated application configuration file and the updated signature configuration file.
[0064] 206. Obtain the build toolchain corresponding to the target application.
[0065] 207. Using a dependency installation tool, install dependency packages for the updated target application based on the initial version number to obtain the target application after dependency installation. Then, using a cleanup tool, clean up residual files in the build environment of the target application after dependency installation to obtain the cleaned target application. Finally, using a build tool, build the application package of the cleaned target application.
[0066] 208. Determine the upload information for the target platform, and upload the application package to the target platform for application release based on the upload information.
[0067] In this embodiment of the invention, for other descriptions of steps 201 and 206-208, please refer to the detailed description of steps 101 and 103-105 in Embodiment 1 of the invention. These descriptions will not be repeated in this embodiment of the invention.
[0068] It is evident that implementation Figure 2 The described automated application packaging and deployment method can obtain the initial information and configuration file of the target application, extract the version number information from the application configuration file and the path information from the signature configuration file, update the current version number field according to preset version number rules and the initial version number to obtain the updated application configuration file, determine the environment variables of the target application, update the signature certificate path field according to the environment variables and the initial signature to obtain the updated signature configuration file, and determine the updated target application based on the updated application configuration file and the updated signature configuration file. It can automatically modify the project version number and configure the signature based on automated scripts, reducing manual operation time, lowering the probability of errors caused by manual configuration file modification, reducing the risk of key leakage, and improving the reliability of the build and deployment process through dependency security. The system uses installation tools to install dependency packages for the updated target application based on the initial version number, resulting in a target application with dependencies installed. It then uses a cleanup tool to remove residual files from the target application's build environment, resulting in a cleaned target application. Finally, it uses a build tool to build the cleaned target application package. This system can automatically perform dependency installation, project cleanup, and project build operations by calling relevant toolchains through automated scripts, improving the overall efficiency and reliability of project build and packaging. It also determines the upload information for the target platform and uploads the application package to the target platform for application release. Based on automated scripts, it can automatically modify the project version number and configure signatures, and the application build process has been automated, reducing operational error rates, improving application development efficiency and reliability, and enhancing the continuity of application integration and delivery.
[0069] Example 3 Please see Figure 3 , Figure 3 This is a schematic diagram of an automated application packaging and publishing device disclosed in an embodiment of the present invention. Figure 3 The described automated application packaging and deployment device can communicate with a network-attached storage device. This device may include an intelligent server or platform for packaging and deploying HarmonyOS applications. The intelligent server may be a NAS server or a cloud server; however, this embodiment of the invention is not limited to this. Figure 3 As shown, the automated application packaging and deployment device may include: The acquisition module 301 is used to acquire the initial information corresponding to the target application and the configuration file of the target application. The initial information includes the initial version number and the initial signature, and the configuration file includes the application configuration file and the signature configuration file. The update module 302 is used to update the version number information in the application configuration file according to the initial version number, and update the path information in the signature configuration file according to the initial signature, so as to obtain the updated target application; The acquisition module 301 is also used to acquire the build toolchain corresponding to the target application. The build toolchain includes dependency installation tools, cleanup tools, and build tools. Build module 303 is used to install dependency packages for the updated target application according to the version number using a dependency installation tool, to obtain the target application after dependency installation, and to clean up residual files in the build environment of the target application after dependency installation using a cleanup tool, to obtain the cleaned target application, and to build the application package of the cleaned target application using a build tool. The first determining module 304 is used to determine the upload information of the target platform and upload the application package to the target platform to publish the target application based on the upload information. The upload information includes the upload interface and upload credentials.
[0070] It is evident that implementation Figure 3 The described automated application packaging and deployment device can obtain the initial information and configuration file of the target application, update the version number information in the application configuration file according to the initial version number, and update the path information in the signature configuration file according to the initial signature to obtain the updated target application. Using a dependency installation tool, it installs dependency packages for the updated target application according to the initial version number, resulting in a dependency-installed target application. Using a cleanup tool, it cleans up residual files in the build environment of the dependency-installed target application, resulting in a cleaned target application. Finally, using a build tool, it builds the application package of the cleaned target application. It can automatically perform dependency installation, project cleanup, and project build operations on the target application by calling relevant toolchains through automated scripts, improving the overall efficiency and reliability of project building and packaging. It determines the upload information of the target platform and uploads the application package to the target platform for application deployment based on the upload information. It can automatically modify the project version number and configuration signature based on automated scripts, and the application building has performed automated packaging and deployment operations, reducing operational error rates, improving the efficiency and reliability of application development, and enhancing the continuity of application integration and delivery.
[0071] In an optional embodiment, such as Figure 4As shown, the update module 302 updates the version number information in the application configuration file according to the initial version number and updates the path information in the signature configuration file according to the initial signature, obtaining the updated target application in the following specific ways: Extract the version number information from the application configuration file and the path information from the signing configuration file. The version number information includes the current version number field, and the path information includes the signing certificate path field. The current version number field is updated according to the preset version number rules and the initial version number to obtain the updated application configuration file; Determine the environment variables of the target application, update the signing certificate path field based on the environment variables and the initial signature, and obtain the updated signing configuration file; The updated target application is determined based on the updated application configuration file and the updated signature configuration file.
[0072] It is evident that implementation Figure 4 The described automated application packaging and deployment device can obtain the initial information and configuration file of the target application, extract the version number information from the application configuration file and the path information from the signature configuration file, update the current version number field according to preset version number rules and the initial version number to obtain the updated application configuration file, determine the environment variables of the target application, update the signature certificate path field according to the environment variables and the initial signature to obtain the updated signature configuration file, and determine the updated target application based on the updated application configuration file and the updated signature configuration file. It can automatically modify the project version number and configure the signature based on automated scripts, reducing manual operation time, lowering the probability of errors caused by manual configuration file modification, reducing the risk of key leakage, and improving the reliability of the build and deployment process. The system uses installation tools to install dependency packages for the updated target application based on the initial version number, resulting in a target application with dependencies installed. It then uses a cleanup tool to remove residual files from the target application's build environment, resulting in a cleaned target application. Finally, it uses a build tool to build the cleaned target application package. This system can automatically perform dependency installation, project cleanup, and project build operations by calling relevant toolchains through automated scripts, improving the overall efficiency and reliability of project build and packaging. It also determines the upload information for the target platform and uploads the application package to the target platform for application release. Based on automated scripts, it can automatically modify the project version number and configure signatures, and the application build process has been automated, reducing operational error rates, improving application development efficiency and reliability, and enhancing the continuity of application integration and delivery.
[0073] In another alternative embodiment, such as Figure 4As shown, the specific methods by which build module 303 installs dependency packages for the updated target application based on the initial version number using the dependency installation tool include: Determine the first version information corresponding to the local dependencies of the updated target application and the second version information corresponding to the dependency declaration file of the target application's development environment; Determine if the first version information matches the second version information. If the first version information does not match the second version information, use the dependency installation tool to install the dependency package for the updated target application based on the initial version number and the second version information.
[0074] It is evident that implementation Figure 4 The described automated application packaging and deployment device can determine the first version information corresponding to the local dependencies of the updated target application and the second version information corresponding to the dependency declaration file of the target application's development environment. It can determine whether the first version information and the second version information match. When the first version information and the second version information do not match, the dependency installation tool installs the dependency package for the updated target application according to the initial version number and the second version information. It can improve the accuracy and reliability of dependency installation operations by detecting the compatibility between local dependencies and dependency declaration files, and improve the compatibility between installed dependencies and the project development environment.
[0075] In yet another alternative embodiment, such as Figure 4 As shown, the automated application packaging and deployment device may further include: The second determining module 305 is used to determine the signature verification information of the signature configuration file, which includes signature validity period information and signature data chain information. The verification module 306 is used to verify the signature verification information according to the preset signature verification rules and obtain the verification result. When the verification result indicates that the signature verification information is valid, the build module 303 is triggered to execute the operation of building the cleaned application package of the target application through the build tool.
[0076] It is evident that implementation Figure 4 The described automated application packaging and deployment device can determine the signature verification information of the signature configuration file. The signature verification information includes signature validity information and signature data chain information. The device verifies the signature verification information according to preset signature verification rules and obtains the verification result. When the verification result indicates that the signature verification information is valid, it triggers the execution of the application package of the updated target application through the build tool. This device can verify the validity of the application signature information before building the application, reduce the application signature error rate, and improve the accuracy and security of application building.
[0077] In yet another alternative embodiment, such as Figure 4As shown, the specific methods by which the build module 303 builds the cleaned target application package using the build tool include: The pre-set difference identification tool identifies modified files in the cleaned target application; The modified files in the target application are incrementally compiled using a build tool to obtain the incremental compilation results, and the updated application package of the target application is built based on the incremental compilation results.
[0078] It is evident that implementation Figure 4 The described automated application packaging and deployment device can identify modified files in the updated target application through a preset difference identification tool, incrementally compile the modified files in the target application through a build tool, obtain the incremental compilation result, and build the updated target application package based on the incremental compilation result. It only compiles the modified files, skips the unchanged dependencies, shortens the application build time, and improves the application build efficiency.
[0079] In yet another alternative embodiment, such as Figure 4 As shown, the specific methods by which the first determining module 304 uploads the application package to the target platform for application release based on the uploaded information include: Determine whether the uploaded credentials meet the preset validity conditions. When the uploaded credentials meet the validity conditions, establish an encrypted transmission channel based on the upload interface. The application package is segmented into multiple data blocks corresponding to the application package, and each data block is uploaded to the target platform through an encrypted transmission channel using a multi-threaded concurrent approach. For each thread's upload task, monitor the upload progress of that thread's upload task. When the upload progress indicates that the transmission is interrupted, re-execute the upload task of that thread based on the exponential backoff algorithm.
[0080] It is evident that implementation Figure 4 The described automated application packaging and deployment device can determine whether the upload credentials meet the preset validity conditions. When the upload credentials meet the validity conditions, an encrypted transmission channel is established according to the upload interface. The application package is then segmented into multiple data blocks corresponding to the application package. Each data block is uploaded to the target platform through the encrypted transmission channel in a multi-threaded concurrent manner. For each thread's upload task, the upload progress of that thread's upload task is monitored. When the upload progress indicates that the transmission is interrupted, the upload task of that thread is re-executed based on an exponential backoff algorithm. This can improve the security and efficiency of application package uploads, thereby improving application deployment efficiency.
[0081] Example 4 Please see Figure 5 , Figure 5 This is a schematic diagram of the structure of an electronic device disclosed in an embodiment of the present invention. For example... Figure 5 As shown, the electronic device may include: Memory 401 storing executable program code; Processor 402 coupled to memory 401; The processor 402 calls the executable program code stored in the memory 401 to execute the steps in the automated application packaging and publishing method described in Embodiment 1 or Embodiment 2 of the present invention.
[0082] Example 5 Please see Figure 6 , Figure 6 This is a schematic diagram of the structure of an automated application packaging and publishing system disclosed in an embodiment of the present invention. Figure 6 As shown, the automated application packaging and publishing system includes at least the automated application packaging and publishing device 30 described in Embodiment 3 of the present invention, and a network attached storage device 50 that is communicatively connected to the automated application packaging and publishing device 30. After the automated application packaging and publishing device 30 completes the application packaging and publishing operation triggered by the developer according to the automated application packaging and publishing method described in Embodiment 1 or Embodiment 2 of the present invention, it obtains the target program that works with the network attached storage device 50. or, As another alternative implementation, see [link to relevant documentation]. Figure 7 , Figure 7 This is a schematic diagram of another automated application packaging and publishing system disclosed in an embodiment of the present invention. Figure 7 As shown, the automated application packaging and publishing system includes at least the electronic device 40 described in Embodiment 4 of the present invention, and the network attached storage device 50 connected to the electronic device 40. After the electronic device 40 completes the application packaging and publishing operation triggered by the developer according to the automated application packaging and publishing method described in Embodiment 1 or Embodiment 2 of the present invention, it obtains the target program that works with the network attached storage device 50.
[0083] Example 6 This invention discloses a computer storage medium storing computer instructions. When these computer instructions are invoked, they are used to execute some or all of the steps in any of the automated application packaging and publishing methods disclosed in Embodiment 1 of this invention.
[0084] Example 7 This invention discloses a computer program product, which includes a non-transitory computer-readable storage medium storing a computer program, and the computer program is operable to cause a computer to perform the steps in the automated application packaging and publishing method described in Embodiment 1 or Embodiment 2.
[0085] The device embodiments described above are merely illustrative. The modules described as separate components may or may not be physically separate. The components shown as modules may or may not be physical modules; that is, they may be located in one place or distributed across multiple network modules. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0086] Through the detailed description of the above embodiments, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, including read-only memory (ROM), random access memory (RAM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), one-time programmable read-only memory (OTPROM), electrically-Erasable Programmable Read-Only Memory (EEPROM), compact disc read-only memory (CD-ROM) or other optical disc storage, disk storage, magnetic tape storage, or any other computer-readable medium that can be used to carry or store data.
[0087] Finally, it should be noted that the application packaging and publishing method, apparatus and system based on automation disclosed in the embodiments of the present invention are merely preferred embodiments of the present invention, and are only used to illustrate the technical solutions of the present invention, and not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. An automated application packaging and deployment method, the method being applied to an electronic device, the electronic device having a target application running on the HarmonyOS system installed, characterized in that... The method includes: Obtain the initial information corresponding to the target application and the configuration file of the target application. The initial information includes the initial version number and the initial signature. The configuration file includes the application configuration file and the signature configuration file. Update the version number information in the application configuration file according to the initial version number, and update the path information in the signature configuration file according to the initial signature to obtain the updated target application; Obtain the build toolchain corresponding to the target application, the build toolchain including dependency installation tools, cleanup tools and build tools; The dependency installation tool installs dependency packages for the target application updated to the initial version number, thereby obtaining the target application after dependency installation. The cleanup tool cleans up residual files in the build environment of the target application after dependency installation, thereby obtaining the cleaned target application. The build tool then builds the application package of the cleaned target application. The upload information of the target platform is determined, and the application package is uploaded to the target platform according to the upload information to publish the target application. The upload information includes the upload interface and upload credentials.
2. The application packaging and deployment method based on automation according to claim 1, characterized in that, The step of updating the version number information in the application configuration file according to the initial version number and updating the path information in the signature configuration file according to the initial signature to obtain the updated target application includes: Extract the version number information from the application configuration file and the path information from the signing configuration file. The version number information includes the current version number field, and the path information includes the signing certificate path field. The current version number field is updated according to the preset version number rules and the initial version number to obtain the updated application configuration file; Determine the environment variables of the target application, and update the signature certificate path field according to the environment variables and the initial signature to obtain the updated signature configuration file; The updated target application is determined based on the updated application configuration file and the updated signature configuration file.
3. The application packaging and publishing method based on automation according to claim 1 or 2, characterized in that, The process of installing dependency packages for the updated target application using the dependency installation tool, based on the initial version number, includes: Determine the first version information corresponding to the local dependencies of the updated target application and the second version information corresponding to the dependency declaration file of the development environment of the target application; Determine whether the first version information matches the second version information. If the first version information does not match the second version information, install the dependency package for the updated target application using the dependency installation tool, based on the initial version number and the second version information.
4. The automated application packaging and publishing method according to claim 1 or 2, characterized in that, The method further includes: Determine the signature verification information of the signature configuration file, wherein the signature verification information includes signature validity period information and signature data chain information; The signature verification information is verified according to the preset signature verification rules to obtain the verification result; When the verification result indicates that the signature verification information is valid, the operation of building the cleaned application package of the target application through the building tool is triggered.
5. The automated application packaging and publishing method according to claim 1 or 2, characterized in that, The step of building the cleaned application package of the target application using the build tool includes: The modified files in the cleaned target application are identified using a preset difference recognition tool; The modified files in the target application are incrementally compiled using the build tool to obtain the incremental compilation result, and the updated application package of the target application is built based on the incremental compilation result.
6. The automated application packaging and publishing method according to claim 1 or 2, characterized in that, The step of uploading the application package to the target platform for application release based on the uploaded information includes: Determine whether the uploaded credential meets the preset validity conditions. When the uploaded credential meets the validity conditions, establish an encrypted transmission channel according to the upload interface. The application package is segmented to obtain multiple data blocks corresponding to the application package, and each data block is uploaded to the target platform through the encrypted transmission channel in a multi-threaded concurrent manner. For each thread's upload task, monitor the upload progress of that thread's upload task. When the upload progress indicates that the transmission is interrupted, re-execute the thread's upload task based on the exponential backoff algorithm.
7. An automated application packaging and publishing device, characterized in that, The device includes: The acquisition module is used to acquire the initial information corresponding to the target application and the configuration file of the target application. The initial information includes the initial version number and the initial signature, and the configuration file includes the application configuration file and the signature configuration file. The update module is used to update the version number information in the application configuration file according to the initial version number, and update the path information in the signature configuration file according to the initial signature, so as to obtain the updated target application; The acquisition module is also used to acquire the build toolchain corresponding to the target application, the build toolchain including dependency installation tools, cleanup tools and build tools; The build module is used to install dependency packages for the target application with the updated version number using the dependency installation tool, to obtain the target application after dependency installation, and to clean up residual files in the build environment of the target application after dependency installation using the cleanup tool, to obtain the cleaned target application, and to build the application package of the cleaned target application using the build tool. The first determining module is used to determine the upload information of the target platform, and upload the application package to the target platform to publish the target application according to the upload information. The upload information includes the upload interface and the upload credential.
8. An electronic device, characterized in that, The electronic device includes: Memory containing executable program code; A processor coupled to the memory; The processor calls the executable program code stored in the memory to execute the automated application packaging and publishing method as described in any one of claims 1-6.
9. A computer storage medium, characterized in that, The computer storage medium stores computer instructions, which, when invoked, are used to execute the automated application packaging and publishing method as described in any one of claims 1-6.
10. An automated application packaging and deployment system, characterized in that, The system includes at least the application packaging and publishing device based on automation as described in claim 7, and a network attached storage device communicatively connected to the application packaging and publishing device based on automation. After the application packaging and publishing device based on automation according to any one of claims 1-6 completes the application packaging and publishing operation triggered by the developer, it obtains a target program that works in conjunction with the network attached storage device. or, The system includes at least the electronic device as described in claim 8, and a network-attached storage device connected to the electronic device. After the electronic device completes the application packaging and publishing operation triggered by the developer according to the automated application packaging and publishing method as described in any one of claims 1-6, it obtains a target program that works in conjunction with the network-attached storage device.