Project file publishing method and device and electronic equipment
By automating the project file packaging process, the target working directory is generated and the target branch code is obtained, solving the problem of low efficiency in manual packaging and improving the efficiency and accuracy of project file packaging.
Patent Information
- Application Number
- CN202410902061.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-05
- Publication Date
- 2024-11-26
AI Technical Summary
The existing method of manually packaging project files is inefficient, prone to errors, and affects project quality and stability.
By acquiring the target script and generating the target workspace, determining the target branch code, obtaining and using script functions from the code repository to package the branch code, generating and publishing the packaged file, the packaging process is automated.
It automates the packaging of project files, reduces manual intervention steps, avoids delays and errors, and improves the efficiency and accuracy of the packaging operation.
Smart Images

Figure CN119025150A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of the Internet, and in particular to a method, device and electronic device for publishing project files. Background Art
[0002] With the rapid development of Web technology, H5 projects have become the mainstream choice for cross-platform application development, and their deployment efficiency and accuracy are directly related to the market competitiveness of products. However, many historical H5 projects still generally use traditional manual packaging and push methods during deployment, which exposes significant problems such as low efficiency, high error rate and high resource consumption when facing complex and changeable multi-environment (development, testing, production, etc.) release requirements. Manual operations not only require developers to repeat tedious steps such as packaging, environment variable configuration, server upload, etc., but are also prone to errors due to human errors, affecting project quality and stability.
[0003] With regard to the problem of low efficiency in manually packaging project files in related technologies, no effective solution has been proposed yet. Summary of the invention
[0004] The present application provides a method, device and electronic device for publishing a project file, so as to solve the problem of low efficiency of manually packaging project files in the related art.
[0005] According to one aspect of the present application, a method for publishing a project file is provided. The method includes: obtaining a target script, and generating a target workspace through a first function in the target script, wherein the target workspace is used to perform a packaging operation on a historical project file, and the first function is used to generate the target workspace; determining the target branch code required for performing the packaging operation according to the historical project file, and obtaining the target branch code from a code library; using a second function in the target script to package the target branch code to obtain a packaged file, and publishing the packaged file to a target operating environment, wherein the second function is used to package the branch code.
[0006] Optionally, generating a target workspace through a first function in a target script includes: setting a first function in the target script, and generating an initial workspace in a directory indicated by the first function when the target script is running; generating an environment configuration file for the initial workspace according to configuration requirements of the historical project file, and configuring a resource environment of the initial workspace according to the environment configuration file to obtain a candidate workspace; obtaining a preset verification command, and verifying the candidate workspace according to the preset verification command, and when a first verification result of the candidate workspace indicates no abnormality, determining the candidate workspace as the target workspace.
[0007] Optionally, obtaining the target branch code from the code repository includes: determining whether the target branch code exists in the code repository in the target workspace; if the target branch code exists in the code repository, generating a code acquisition instruction based on the target branch code, and sending the code acquisition instruction to the code repository to obtain the target branch code; if the target branch code does not exist in the code repository, sending the code acquisition instruction to the remote code repository to obtain the target branch code, and storing the target branch code in the code repository.
[0008] Optionally, the target branch code is packaged using the second function in the target script to obtain a packaged file, including: inputting the target branch code into the target script, processing the target branch code through the second function, and obtaining a static file; configuring a verification server in the device in the deployed target workspace, and performing a verification operation on the static file in the verification server to obtain a second verification result, wherein the verification operation includes: manual test verification and automated test verification; when the second verification result indicates that the static file is normal, determining that the static file is a packaged file.
[0009] Optionally, publishing the packaged file to the target operating environment includes: obtaining a file data volume receiving range of the target operating environment, and compressing the packaged file according to the file data volume receiving range to obtain a compressed file; obtaining an encryption method of the target operating environment, and encrypting the compressed file by the encryption method to obtain an encrypted file; sending the encrypted file to the target operating environment, wherein, after the target operating environment receives the encrypted file, it decrypts and decompresses the encrypted file to obtain a packaged file, and runs the packaged file.
[0010] Optionally, after obtaining the packaged file, the method also includes: obtaining characteristic information of the packaged file, and obtaining characteristic values corresponding to the characteristic information from the packaged file; obtaining a preset display style, and adding the characteristic information and characteristic values to the preset display style to obtain a characteristic information display interface; storing the characteristic information display interface to the storage space in the target workspace.
[0011] Optionally, publishing the packaged file to the target operating environment includes: obtaining address information of the target operating environment; determining whether the target operating environment has an abnormality based on the address information; if it is determined that the target operating environment has an abnormality, storing the packaged file in a storage space in a target workspace until the target operating environment has no abnormality; if it is determined that the target operating environment has no abnormality, publishing the packaged file to the target operating environment.
[0012] According to another aspect of the present application, a project file publishing device is provided. The device includes: a generation unit, which is used to obtain a target script, and generate a target workspace through a first function in the target script, wherein the target workspace is used to perform a packaging operation on a historical project file, and the first function is used to generate the target workspace; a first acquisition unit, which is used to determine the target branch code required to perform the packaging operation according to the historical project file, and obtain the target branch code from the code library; a packaging unit, which is used to package the target branch code using the second function in the target script to obtain a packaged file, and publish the packaged file to a target operating environment, wherein the second function is used to package the branch code.
[0013] According to another aspect of the present invention, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, a method for publishing a project file in the present application is implemented.
[0014] According to another aspect of the present invention, an electronic device is provided, comprising one or more processors and a memory; the memory stores computer-readable instructions, and the processor is used to execute the computer-readable instructions, wherein a method for publishing a project file is executed when the computer-readable instructions are executed.
[0015] Through this application, the following steps are adopted: obtain the target script, and generate the target workspace through the first function in the target script, wherein the target workspace is used to perform packaging operations on historical project files, and the first function is used to generate the target workspace; determine the target branch code required to perform the packaging operation according to the historical project file, and obtain the target branch code from the code library; use the second function in the target script to package the target branch code to obtain a packaged file, and publish the packaged file to the target operating environment, wherein the second function is used to package the branch code. The problem of low efficiency of manually packaging project files in the related art is solved. By obtaining and running the target script, the entire packaging process (including generating a workspace, determining the target branch, obtaining code, packaging, and publishing) is automated, thereby greatly reducing the steps of manual intervention, avoiding delays and errors that may be caused by manual operations, and shortening the release cycle, thereby achieving the technical effect of improving the efficiency and accuracy of project file packaging operations. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] The drawings constituting a part of the present application are used to provide a further understanding of the present application. The illustrative embodiments and descriptions of the present application are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0017] Figure 1 is a flowchart of a method for publishing a project file provided in an embodiment of the present application;
[0018] Figure 2 is a flowchart of an optional project file publishing method provided according to an embodiment of the present application;
[0019] Figure 3 is a schematic diagram of a project file publishing device provided according to an embodiment of the present application;
[0020] Figure 4 It is a schematic diagram of an electronic device provided according to an embodiment of the present application. DETAILED DESCRIPTION
[0021] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0022] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.
[0023] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present application described here. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0024] It should be noted that the project file publishing method, device and electronic device determined in the present disclosure can be used in the Internet field, and can also be used in any field other than the Internet field. The application field of the project file publishing method, device and electronic device determined in the present disclosure is not limited.
[0025] It should be noted that the collected information, user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) used in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, storage, use, processing, transmission, provision, disclosure and application of relevant data are in compliance with the relevant laws, regulations and standards of the relevant regions, necessary confidentiality measures are taken, and public order and good customs are not violated. Corresponding operation portals are provided for users to choose to authorize or refuse to use. For example, an interface is set up between this system and relevant users or organizations. Before obtaining relevant information, it is necessary to send an acquisition request to the aforementioned user or organization through the interface, and obtain relevant information after receiving the consent information fed back by the aforementioned user or organization.
[0026] For the convenience of description, some nouns or terms involved in the embodiments of the present application are explained below:
[0027] H5 project: a project developed based on HTML5 technology.
[0028] Git repository: A directory (or folder) that uses the Git version control system to manage and track file changes. Git is an open source distributed version control system that allows developers to efficiently handle projects of any size.
[0029] According to an embodiment of the present application, a method for publishing a project file is provided.
[0030] Figure 1 Flowchart of the method for publishing project files according to the embodiment of the present application. Figure 1 As shown, the method comprises the following steps:
[0031] Step S101, obtaining a target script, and generating a target workspace through a first function in the target script, wherein the target workspace is used to package historical project files, and the first function is used to generate the target workspace.
[0032] It should be noted that the target script is a predefined script file that contains a series of automated operation instructions and functions to guide the entire packaging and deployment process. The first function is a specific function defined in the target script. Its function is to create a dedicated workspace (or environment) according to the requirements. The workspace will be used for subsequent packaging operations to ensure the independence and security of the operations. The target workspace is an independent working environment or folder created by the first function, which is specifically used to store and process files and resources in the packaging process to avoid affecting other projects or operations.
[0033] Specifically, before packaging a project, you first need to write a target script, and when packaging a historical project, you can obtain the target script containing the packaging logic. Then, execute the first function in the script, which creates a new target workspace in the system according to the preset rules and configurations. This workspace will become the basis for all subsequent packaging operations, ensuring the independence and controllability of the packaging process.
[0034] It should be noted that the target script may include a series of automated operation instructions and functions to guide the entire packaging and deployment process, such as the first function for creating a target workspace, or the second function for packaging project files, thereby executing different operations in the packaging process through different functions in the target script to complete the packaging operation of historical project files.
[0035] Step S102, determining the target branch code required for executing the packaging operation according to the historical project file, and obtaining the target branch code from the code library.
[0036] It should be noted that the historical project file may be a file that needs to be automatically packaged, which may contain project version information, branch information or other metadata to indicate the specific project version or branch that needs to be packaged. The target branch code is a code set of a specific branch that needs to be packaged based on the historical project file. The code base is a central repository that stores all versions and branch codes of the project, such as a Git repository.
[0037] Specifically, after obtaining the target script and generating the target workspace, the system will determine the specific project branch that needs to be packaged based on the information in the historical project file. Then, the system can connect to the code library (such as a Git repository) and obtain the latest code of the corresponding branch, that is, the target branch code, so that when packaging is performed later, the target branch code can be used for packaging operations, thereby ensuring that the packaged content is consistent with the actual needs of the historical project.
[0038] Furthermore, when determining the specific project branches that need to be packaged based on the information in the historical project files, you can first determine the project documents or notes that need to be consulted first for the packaging branch based on the information in the historical project files, thereby determining the branch information associated with the release plan of the historical project files, that is, determining the target branch code, and further determining the code library that stores the target branch code, and then obtaining the target branch code from the code library, and completing subsequent packaging operations based on the target branch code.
[0039] Step S103, using the second function in the target script to package the target branch code, obtain a packaged file, and publish the packaged file to the target operating environment, wherein the second function is used to package the branch code.
[0040] It should be noted that the second function can be a specific function defined in the target script, which is used to package the acquired target branch code to generate a deployable package file. The package file is a collection of code and resources that have been compiled, compressed, etc., and can be directly deployed to the operating environment for execution. The target operating environment is the server or environment to which the package file is ultimately deployed, such as a test environment, a production environment, etc.
[0041] Specifically, the system can call the second function in the target script to package the target branch code obtained from the code library. The process of the second function packaging the target branch code will include code compilation, resource merging and compression, dependency parsing and packaging, etc. After completing the packaging operation, the system will generate one or more packaging files, which contain all the code and resources required to run the project. Finally, the system will publish the packaging file to the specified target running environment for subsequent testing or online operations, thereby completing the entire process of automated packaging and achieving the technical effect of improving the packaging efficiency of historical project files.
[0042] The method for publishing project files provided in the embodiment of the present application obtains a target script, and generates a target workspace through a first function in the target script, wherein the target workspace is used to perform a packaging operation on historical project files, and the first function is used to generate the target workspace; the target branch code required for performing the packaging operation is determined according to the historical project file, and the target branch code is obtained from the code library; the target branch code is packaged using the second function in the target script to obtain a packaged file, and the packaged file is published to the target operating environment, wherein the second function is used to package the branch code. The problem of low efficiency of manually packaging project files in the related art is solved. By obtaining and running the target script, the entire packaging process (including generating a workspace, determining a target branch, obtaining code, packaging, and publishing) is automated, thereby greatly reducing the steps of manual intervention, avoiding delays and errors that may be caused by manual operations, and shortening the publishing cycle, thereby achieving the technical effect of improving the efficiency and accuracy of project file packaging operations.
[0043] Optionally, in the project file publishing method provided in the embodiment of the present application, generating a target workspace through the first function in the target script includes: setting the first function in the target script, and generating an initial workspace in the directory indicated by the first function when the target script is running; generating an environment configuration file for the initial workspace according to the configuration requirements of the historical project file, and configuring the resource environment of the initial workspace according to the environment configuration file to obtain a candidate workspace; obtaining a preset verification command, and verifying the candidate workspace according to the preset verification command, and when the first verification result of the candidate workspace indicates no abnormality, determining the candidate workspace as the target workspace.
[0044] Specifically, when generating a target workspace, you first need to set a first function in the target script, so as to generate the target workspace through the first function. First, define the first function in the target script. The first function is responsible for the initialization process of the entire workspace. The first function can accept one or more parameters, such as the target directory path of the workspace, the project type, etc., for flexible configuration.
[0045] Furthermore, after obtaining the first function, the root directory of the workspace can be created according to the directory path within the first function, and then the initial directory structure can be planned and created, such as the source code directory, the test directory, the configuration file directory, etc. After completing the creation of the initial workspace, the template of the environment configuration file is prepared according to the configuration requirements of the historical project file, and the placeholders in the template are dynamically filled according to the specific requirements of the historical project file to generate the actual environment configuration file, so as to configure the resource environment of the workspace according to the generated environment configuration file to obtain the candidate workspace.
[0046] Furthermore, when the candidate workspace is obtained, it is also necessary to verify the candidate workspace to determine whether the candidate workspace is incorrect. A series of preset verification commands (such as environment variable check, dependency installation check, basic function test, etc.) can be defined, and the configuration of the workspace can be verified according to the above preset verification commands to verify whether it is correct, so as to verify the candidate workspace according to the preset verification commands. If the execution results of all verification commands (that is, the first verification result) indicate that there is no abnormality, it indicates that there is no abnormality in the candidate workspace. At this time, the candidate workspace can be determined as the target workspace, and then the creation operation of the target workspace is completed.
[0047] This embodiment sets the first function in the target script, reads the historical project configuration requirements, generates and configures the environment, and then verifies the workspace through a preset verification command to obtain the target workspace, thereby achieving the purpose of improving project deployment and development efficiency and enhancing environmental consistency and stability through the target workspace.
[0048] Optionally, in the project file publishing method provided in the embodiment of the present application, obtaining the target branch code from the code library includes: determining whether the target branch code exists in the code library in the target workspace; if the target branch code exists in the code library, generating a code acquisition instruction according to the target branch code, and sending the code acquisition instruction to the code library to obtain the target branch code; if the target branch code does not exist in the code library, sending the code acquisition instruction to the remote code library to obtain the target branch code, and storing the target branch code in the code library.
[0049] Specifically, when obtaining the target branch code, the script will first check whether the code library (such as a Git repository) in the target workspace has been initialized, and confirm whether the target branch code exists in the code library in the target workspace. The script can list the branches of the code library by executing a preset search command, and then search the list for the specified target branch code, thereby determining whether the target branch code exists in the code library in the target workspace.
[0050] Furthermore, if the target branch code exists in the local code base, the script will generate a code acquisition instruction and execute the instruction immediately to obtain the target branch code. At this time, there is no need to interact with the remote code base, which improves efficiency. If the target branch code does not exist in the local code base, the script will construct a code acquisition instruction pointing to the remote code base. After executing the instruction, the target branch code will be downloaded from the remote code base to the local and stored in the target code base, thus completing the acquisition operation of the target branch code.
[0051] This embodiment checks the status of the local code library and the existence of the target branch code, and determines different code acquisition methods according to the storage location of the target branch code, thereby optimizing the code acquisition efficiency by reducing unnecessary remote interactions, and ensuring that the target branch code can still be accurately acquired when the target branch code does not exist locally, thereby improving the accuracy and efficiency of acquiring the target branch code.
[0052] Optionally, in the project file publishing method provided in the embodiment of the present application, the target branch code is packaged using the second function in the target script to obtain the packaged file, including: inputting the target branch code into the target script, processing the target branch code through the second function, and obtaining a static file; configuring a verification server in the device where the target workspace is deployed, and performing a verification operation on the static file in the verification server to obtain a second verification result, wherein the verification operation includes: manual test verification and automated test verification; when the second verification result indicates that the static file is normal, determining that the static file is a packaged file.
[0053] Specifically, when the target branch code is packaged, since the target branch code is already in the target workspace, the target branch code can be packaged directly. When the target script packages the target branch code, the second function in the target script is called to start processing the target branch code. The processing may include: code cleaning (such as deleting unnecessary files or logs), building (compiling, packaging static resources, etc.), optimization, etc., so as to obtain a set of static files, which are the final deployable version of the target branch code.
[0054] Furthermore, after obtaining the static file, the static file needs to be verified. When verifying the static file, you can deploy a verification server. Configure a verification server in the device of the deployment target workspace and verify the static file through the verification server. First, upload the generated static file to the verification server, and use the automated testing framework and scripts in the verification server to execute the test verification process. The test verification process can cover multiple scenarios and edge cases, thereby improving the efficiency and accuracy of the test.
[0055] Furthermore, when the second verification result indicates that there is no abnormality in the static file, it can be determined that the static file is a packaged file, and the packaged file is published, thereby ensuring the accuracy of the static file.
[0056] This embodiment uses scripts to automatically process target branch codes and generate static files, and uses a verification server for testing and verification, thereby improving the efficiency of code packaging and verification, and can promptly discover and repair potential security vulnerabilities, thereby enhancing the security of deploying static files.
[0057] Optionally, in the project file publishing method provided in the embodiment of the present application, publishing the packaged file to the target operating environment includes: obtaining the file data volume receiving range of the target operating environment, and compressing the packaged file according to the file data volume receiving range to obtain a compressed file; obtaining the encryption method of the target operating environment, and encrypting the compressed file by the encryption method to obtain an encrypted file; sending the encrypted file to the target operating environment, wherein, after the target operating environment receives the encrypted file, it decrypts and decompresses the encrypted file to obtain the packaged file, and runs the packaged file.
[0058] Specifically, in order to ensure the compatibility of the generated packaged file and the target operating environment, and to ensure that the target operating environment can receive the packaged file, it is first necessary to determine the file processing capability of the target operating environment, including the maximum receivable file size, the types supported by the file system, etc., and further process the size of the packaged file according to the file data volume receiving range of the target operating environment. In the case that the packaged file is too large, the packaged file needs to be compressed to ensure that the target operating environment can receive the packaged file.
[0059] Furthermore, since some branch codes need to be transmitted in encrypted form, when transmitting packaged files, it is necessary to first obtain the encryption method of the target operating environment, and encrypt the packaged files according to the encryption method to obtain the encrypted file, and then send the encrypted file to the target operating environment, thereby ensuring the security of the packaged files during transmission.
[0060] This embodiment adaptively modifies the file size of the packaged file and encrypts the packaged file when transmitting the packaged file, thereby ensuring that the target operating environment can accurately and securely receive the packaged file, and ensuring the security and stability of the transmission process.
[0061] Optionally, in the project file publishing method provided in the embodiment of the present application, after obtaining the packaged file, the method further includes: obtaining characteristic information of the packaged file, and obtaining characteristic values corresponding to the characteristic information from the packaged file; obtaining a preset display style, and adding the characteristic information and the characteristic value to the preset display style to obtain a characteristic information display interface; and storing the characteristic information display interface in the storage space in the target workspace.
[0062] Specifically, the system automatically triggers the feature information extraction operation at the node of the packaging process to ensure the integrity and timeliness of the information. The extracted feature information includes but is not limited to project ID, build start / end time, build server name, software version number (such as Git tag or submission ID), and original code branch name, etc., and obtains the feature value of each feature information.
[0063] Furthermore, after obtaining the characteristic values, the extracted characteristic values can be integrated into a standardized data format through an algorithm or a rule engine for unified processing and display. After processing the characteristic values, the characteristic values can be added to a preset display style, such as displaying the characteristic information in the form of a table, icon or text to obtain a characteristic information display interface. Through the characteristic information display interface, relevant information of the packaged file can be obtained, which is convenient for users to quickly browse and understand. At the same time, when modifying the packaged file, the convenience and accuracy of the modification operation of the packaged file can be improved according to the characteristic information display interface.
[0064] This embodiment effectively improves the transparency and manageability of software status information after packaging by generating a feature information display interface, and can provide developers, operation and maintenance personnel, etc. with a way to quickly obtain information related to the packaged files. At the same time, it can also improve the convenience and accuracy of operations, and provide strong support for the efficient operation and quality control of subsequent projects.
[0065] Optionally, in the project file publishing method provided in the embodiment of the present application, publishing the packaged file to the target operating environment includes: obtaining address information of the target operating environment; determining whether there is an abnormality in the target operating environment based on the address information; if it is determined that there is an abnormality in the target operating environment, storing the packaged file in the storage space in the target workspace until the target operating environment is normal; if it is determined that there is no abnormality in the target operating environment, publishing the packaged file to the target operating environment.
[0066] It should be noted that in order to ensure that the target operating environment can normally receive the packaged file, it is also necessary to determine whether there is an abnormality in the target operating environment. If there is an abnormality in the target operating environment, the packaged file cannot be sent to the target operating environment. At this time, the packaged file can only be stored in the storage space in the target workspace until the target operating environment is normal. Only after it is determined that there is no abnormality in the target operating environment can the packaged file be published to the target operating environment, thereby ensuring that the packaged file can be accurately received by the target operating environment, thereby achieving the technical effect of improving the efficiency and accuracy of publishing packaged files.
[0067] Figure 2 is a flowchart of an optional project file publishing method provided in an embodiment of the present application, such as Figure 2 As shown, when packaging historical project files, it is first necessary to obtain the target script and execute the target script, generate the target workspace through the target script, and obtain the basic information of the historical project files. According to the basic information of the historical project files, the target branch code is pulled from the code library, and the target branch code is packaged, and a health check page is generated at the same time, wherein the health check page is used to display the attribute information of the packaging operation on the target branch code, such as the packaging project, time, environment, version number, original branch, etc. After the packaging is completed, the script is used to automatically copy the output package file to the newly established workspace and automatically push it, thereby completing the technical effect of automatic packaging and pushing of historical project files. The package push is implemented automatically through the script, and the corresponding health check page is generated. It can avoid errors caused by manual operation and improve the efficiency, accuracy and safety of publishing. And the health check page can quickly troubleshoot the problems of the project package and improve the efficiency of developers.
[0068] It should be noted that the steps shown in the flowcharts of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and that, although a logical order is shown in the flowcharts, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0069] The embodiment of the present application also provides a project file publishing device. It should be noted that the project file publishing device of the embodiment of the present application can be used to execute the project file publishing method provided by the embodiment of the present application. The project file publishing device provided by the embodiment of the present application is introduced below.
[0070] Figure 3 Schematic diagram of a project file publishing device provided according to an embodiment of the present application. Figure 3 As shown, the device includes: a generating unit 31, a first acquiring unit 32, and a packaging unit 33.
[0071] The generating unit 31 is used to obtain a target script and generate a target workspace through a first function in the target script, wherein the target workspace is used to package the historical project files and the first function is used to generate the target workspace.
[0072] The first acquisition unit 32 is used to determine the target branch code required to perform the packaging operation according to the historical project file, and acquire the target branch code from the code library.
[0073] The packaging unit 33 is used to package the target branch code using the second function in the target script to obtain a packaged file, and publish the packaged file to the target operating environment, wherein the second function is used to package the branch code.
[0074] The project file publishing device provided in the embodiment of the present application obtains the target script through the generation unit 31, and generates the target workspace through the first function in the target script, wherein the target workspace is used to perform a packaging operation on the historical project file, and the first function is used to generate the target workspace; the first acquisition unit 32 determines the target branch code required for performing the packaging operation according to the historical project file, and obtains the target branch code from the code library; the packaging unit 33 uses the second function in the target script to package the target branch code, obtains a package file, and publishes the package file to the target operating environment, wherein the second function is used to package the branch code. The problem of low efficiency of manually packaging project files in the related art is solved. By obtaining and running the target script, the entire packaging process (including generating a workspace, determining a target branch, obtaining code, packaging, and publishing) is automated, thereby greatly reducing the steps of manual intervention, avoiding delays and errors that may be caused by manual operations, and shortening the publishing cycle, thereby achieving the technical effect of improving the efficiency and accuracy of the project file packaging operation.
[0075] Optionally, in the project file publishing device provided in the embodiment of the present application, the generation unit 31 includes: a first generation module, which is used to set a first function in a target script, and generate an initial workspace in a directory indicated by the first function when the target script is running; a second generation module, which is used to generate an environment configuration file of the initial workspace according to the configuration requirements of the historical project file, and configure the resource environment of the initial workspace according to the environment configuration file to obtain a candidate workspace; a first verification module, which is used to obtain a preset verification command, and verify the candidate workspace according to the preset verification command, and when the first verification result of the candidate workspace indicates no abnormality, the candidate workspace is determined as the target workspace.
[0076] Optionally, in the project file publishing device provided in the embodiment of the present application, the first acquisition unit 32 includes: a first judgment module, used to judge whether the target branch code exists in the code library in the target workspace; a first sending module, used to generate a code acquisition instruction according to the target branch code when the target branch code exists in the code library, and send the code acquisition instruction to the code library to obtain the target branch code; a second sending module, used to send the code acquisition instruction to the remote code library when the target branch code does not exist in the code library, obtain the target branch code, and store the target branch code in the code library.
[0077] Optionally, in the project file publishing device provided in the embodiment of the present application, the packaging unit 33 includes: a processing module, which is used to input the target branch code into the target script, and process the target branch code through a second function to obtain a static file; a second verification module, which is used to configure a verification server in the device where the target workspace is deployed, and perform a verification operation on the static file in the verification server to obtain a second verification result, wherein the verification operation includes: manual test verification and automated test verification; a determination module, which is used to determine that the static file is a packaged file when the second verification result indicates that the static file is normal.
[0078] Optionally, in the project file publishing device provided in the embodiment of the present application, the packaging unit 33 includes: a first acquisition module, used to obtain the file data volume receiving range of the target operating environment, and compress the packaged file according to the file data volume receiving range to obtain a compressed file; an encryption module, used to obtain the encryption method of the target operating environment, and encrypt the compressed file by the encryption method to obtain an encrypted file; a third sending module, used to send the encrypted file to the target operating environment, wherein, after the target operating environment receives the encrypted file, it decrypts and decompresses the encrypted file to obtain a packaged file, and runs the packaged file.
[0079] Optionally, in the project file publishing device provided in the embodiment of the present application, after obtaining the packaged file, the device also includes: a second acquisition unit, used to obtain characteristic information of the packaged file, and obtain characteristic values corresponding to the characteristic information from the packaged file; a third acquisition unit, used to obtain a preset display style, and add the characteristic information and the characteristic value to the preset display style to obtain a characteristic information display interface; a storage unit, used to store the characteristic information display interface in the storage space in the target workspace.
[0080] Optionally, in the project file publishing device provided in the embodiment of the present application, the packaging unit 33 includes: a second acquisition module, used to obtain address information of the target operating environment; a second judgment module, used to judge whether there is an abnormality in the target operating environment based on the address information; a storage module, used to store the packaged file in the storage space in the target workspace when it is judged that there is an abnormality in the target operating environment, until the target operating environment is normal; a publishing module, used to publish the packaged file to the target operating environment when it is judged that there is no abnormality in the target operating environment.
[0081] The project file publishing device includes a processor and a memory. The generation unit 31, the first acquisition unit 32, the packaging unit 33, etc. are all stored in the memory as program units. The processor executes the program units stored in the memory to implement corresponding functions.
[0082] The processor includes a kernel, which retrieves the corresponding program unit from the memory. One or more kernels can be set, and the problem of low efficiency of manually packaging project files in related technologies is solved by adjusting kernel parameters.
[0083] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.
[0084] An embodiment of the present invention provides a computer-readable storage medium on which a program is stored. When the program is executed by a processor, the project file publishing method is implemented.
[0085] An embodiment of the present invention provides a processor, which is used to run a program, wherein the project file publishing method is executed when the program is running.
[0086] Figure 4 is a schematic diagram of an electronic device provided according to an embodiment of the present application, such as Figure 4 As shown, an embodiment of the present invention provides an electronic device, the electronic device 40 includes a processor, a memory, and a program stored in the memory and executable on the processor, and the processor implements the following steps when executing the program: obtaining a target script, and generating a target workspace through a first function in the target script, wherein the target workspace is used to package historical project files, and the first function is used to generate the target workspace; determining the target branch code required for performing the packaging operation according to the historical project files, and obtaining the target branch code from the code library; using the second function in the target script to package the target branch code, obtaining a packaged file, and publishing the packaged file to the target operating environment, wherein the second function is used to package the branch code. The device in this article can be a server, PC, PAD, mobile phone, etc.
[0087] The present application also provides a computer program product, which, when executed on a data processing device, is suitable for executing an initialization program having the following method steps: obtaining a target script, and generating a target workspace through a first function in the target script, wherein the target workspace is used to perform a packaging operation on historical project files, and the first function is used to generate the target workspace; determining a target branch code required to perform a packaging operation based on the historical project files, and obtaining the target branch code from a code library; using a second function in the target script to package the target branch code to obtain a packaged file, and publishing the packaged file to a target operating environment, wherein the second function is used to package the branch code.
[0088] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0089] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0090] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0091] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0092] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0093] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0094] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0095] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0096] The above are only embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included within the scope of the claims of the present application.
Claims
1. A method for publishing a project file, characterized in that: include: Obtain a target script, and generate a target workspace through a first function in the target script, wherein the target workspace is used to perform a packaging operation on historical project files, and the first function is used to generate the target workspace; Determine the target branch code required to perform the packaging operation according to the historical project file, and obtain the target branch code from the code library; The target branch code is packaged using a second function in the target script to obtain a packaged file, and the packaged file is published to a target operating environment, wherein the second function is used to package the branch code.
2. The method according to claim 1, characterized in that Generating a target workspace by using the first function in the target script includes: The first function is set in the target script, and when the target script is running, an initial workspace is generated according to the directory indicated by the first function; Generate an environment configuration file for the initial workspace according to the configuration requirements of the historical project file, and configure the resource environment of the initial workspace according to the environment configuration file to obtain a candidate workspace; A preset verification command is obtained, and the candidate work area is verified according to the preset verification command. When a first verification result of the candidate work area indicates that there is no abnormality, the candidate work area is determined as the target work area.
3. The method according to claim 1, characterized in that Obtaining the target branch code from the code base includes: Determine whether the target branch code exists in the code library in the target workspace; If the target branch code exists in the code library, generating a code acquisition instruction according to the target branch code, and sending the code acquisition instruction to the code library to obtain the target branch code; In the case that the target branch code does not exist in the code library, the code acquisition instruction is sent to the remote code library to obtain the target branch code, and the target branch code is stored in the code library.
4. The method according to claim 1, characterized in that: The target branch code is packaged using the second function in the target script, and the packaged file obtained includes: Inputting the target branch code into the target script, and processing the target branch code by the second function to obtain a static file; configuring a verification server in the device where the target workspace is deployed, and performing a verification operation on the static file in the verification server to obtain a second verification result, wherein the verification operation includes: manual test verification and automated test verification; When the second verification result indicates that the static file is normal, the static file is determined to be the packaged file.
5. The method according to claim 1, characterized in that Publishing the packaged file to the target operating environment includes: Acquiring a file data volume receiving range of the target operating environment, and compressing the packaged file according to the file data volume receiving range to obtain a compressed file; Acquire the encryption method of the target operating environment, and encrypt the compressed file using the encryption method to obtain an encrypted file; The encrypted file is sent to the target operating environment, wherein after receiving the encrypted file, the target operating environment decrypts and decompresses the encrypted file to obtain the packaged file, and runs the packaged file.
6. The method according to claim 1, characterized in that After obtaining the packaged file, the method further includes: Acquire characteristic information of the packaged file, and acquire characteristic values corresponding to the characteristic information from the packaged file; Obtaining a preset display style, and adding the characteristic information and the characteristic value to the preset display style to obtain a characteristic information display interface; The feature information display interface is stored in the storage space in the target workspace.
7. The method according to claim 1, characterized in that Publishing the packaged file to the target operating environment includes: Obtaining address information of the target operating environment; Determining whether the target operating environment is abnormal according to the address information; When it is determined that the target operating environment is abnormal, the packaged file is stored in the storage space of the target workspace until the target operating environment is normal; When it is determined that there is no abnormality in the target operating environment, the packaged file is published to the target operating environment.
8. A project file publishing device, characterized in that: include: A generating unit, configured to obtain a target script, and generate a target workspace through a first function in the target script, wherein the target workspace is used to perform a packaging operation on historical project files, and the first function is used to generate the target workspace; A first acquisition unit, configured to determine a target branch code required to perform the packaging operation according to the historical project file, and acquire the target branch code from a code library; The packaging unit is used to package the target branch code using the second function in the target script to obtain a packaged file, and publish the packaged file to the target operating environment, wherein the second function is used to package the branch code.
9. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the method for publishing a project file according to any one of claims 1 to 7 is implemented.
10. An electronic device, characterized in that: It includes one or more processors and a memory, wherein the memory is used to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the project file publishing method described in any one of claims 1 to 7.
