1. Create a free style task, enter the configuration item General and select the parameterized build process
1. Add option parameters
BUILD_TYPE Sets debug release
2. Add character parameters
APP_VERSION_NAME APP_VERSION_CODE IS_JENKINS
3. Project code adjustment
We need to add the parameter we just added in the gradle.properties file of the project
BUILD_TYPE APP_VERSION_NAME APP_VERSION_CODE IS_JENKINS
Copy the code
Then modify the app build.gradle to use these parameters such as:
defaultConfig {
minSdkVersion 19
targetSdkVersion 29
versionCode APP_VERSION_CODE as int
versionName APP_VERSION_NAME
}
Copy the code
Assemble ${BUILD_TYPE} in Jenkins
Pass all job parameters as Project properties
Save complete, start packing.
Second, packaging complete automatic upload dandelion
1. Install the dandelion plug-in
Go to Plug-in Management and search Upload to pgyer to complete the installation.
2. Add new archived products
Address Fill in your own packaged address (so that you can display apK after the execution is complete)
app/build/outputs/apk/${BUILD_TYPE}/*.apk
Add upload to pgyer with apiV1
Fill in the two keys according to your account number
${WORKSPACE}/app/build/outputs/apk/${BUILD_TYPE}
app-${BUILD_TYPE}.apk
Copy the code
4. Dandelion display download QR code
Install the Description setter plugin
Go back to the post-build step set build Description
Fill in the following information:
<a href="${appBuildURL}"><img src="${appQRCodeURL}" width="118px" height="118px"></a>
Copy the code
Change the formatter to Safe HTML, and then repackage the project.
After the package is completed, you can see the download QR code and the result of the build in the interface.
Copyright Notice: All articles in this blog are licensed under CC BY 4.0CN unless otherwise stated. Reprint please indicate the source!