Skip to content

Commit

Permalink
1.24
Browse files Browse the repository at this point in the history
  • Loading branch information
myroid committed Sep 16, 2017
0 parents commit 90c731d
Show file tree
Hide file tree
Showing 41 changed files with 1,698 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Created by .ignore support plugin (hsz.mobi)
.idea
target
*.iml
pom.xml.releaseBackup
release.properties
1 change: 1 addition & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
buildPlugin()
58 changes: 58 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
[![license](https://img.shields.io/github/license/mashape/apistatus.svg)](http://opensource.org/licenses/MIT)  
[![upload-pgyer](https://img.shields.io/badge/upload--pgyer-1.24-brightgreen.svg)](https://github.com/myroid/jenkins-upload-pgyer-plugin)  
[![downloads](https://img.shields.io/badge/downloads-%3C1K-orange.svg)](https://github.com/myroid/jenkins-upload-pgyer-plugin)  
[![blog](https://img.shields.io/badge/blog-dafan.tech-red.svg)](http://dafan.tech)

### upload-pgyer-jenkins-plugin

[中文文档](./README_cn.md)

Pgyer's official website is [https://www.pgyer.com/](https://www.pgyer.com/)

Pgyer can upload the application to the site, generate installation link and qr code user to open the installation link, or scan code qr code, can start installation.

So this plugin can be uploaded to the pgyer platform!**And it can put the fields returned by pgyer into an environment variable, which you can use in other build steps**, You can select `upload to pgyer` by adding build steps or adding post-build steps.

Screenshot
![](./img/upload-pgyer.png)

field|explanation
----:|:----------
pgyer uKey|`(Required)` User Key, used to identify the current user's identity, <br/>for the same pgyer registered users, the value of the fixed!<br/>[Click to get pgyer uKey](https://www.pgyer.com/account/api)
pgyer api_key|`(Required)` API Key, used to identify the identity of the API caller, <br/>if not specified, each interface needs to contain this parameter.<br/>For the same pgyer registered users, this value is fixed.<br/>[Click to get pgyer api_key](https://www.pgyer.com/account/api)
scandir|`(Required)` need to upload ipa or apk file base dir path!<br/> The default is ${WORKSPACE}, It means the path of the current project!<br/>It is using ant's DirectoryScanner class, [click to see DirectoryScanner class](https://ant.apache.org/manual/api/org/apache/tools/ant/DirectoryScanner.html)<br/>**It is equivalent to the parameters of the basedir method in the DirectoryScanner class!** [click to see basedir method](https://ant.apache.org/manual/api/org/apache/tools/ant/DirectoryScanner.html#basedir)
file wildcard|`(Required)` need to upload ipa or apk file name, Support wildcards,<br/>like this: **/Test?/*.apk<br/>It is using ant's DirectoryScanner class, [click to see DirectoryScanner class](https://ant.apache.org/manual/api/org/apache/tools/ant/DirectoryScanner.html)<br/> **It is equivalent to the parameters of the includes method in the DirectoryScanner class!** [click to see includes method](https://ant.apache.org/manual/api/org/apache/tools/ant/DirectoryScanner.html#includes)
installType|`(Optional)` application installation, the value is (1,2,3).<br/>1: public, <br/>2: password installed, <br/>3: invitation to install.<br/>The default is 1 public!
password|(Optional) set the App installation password, if you do not want to set the password, please pass empty string, or not pass.
updateDescription|`(Optional)` version update description, please pass empty string, or not pass.
qrcodePath|`(Optional)` If you need to download the qrcode, please enter the save path of the qrcode!otherwise, not download!
envVarsPath|`(Optional)` if you need to save info, please enter save file path! otherwise, not save!

Running log
![](./img/upload-pgyer-2.png)

When it runs successfully, you can use the environment variables that are used! for example:

![](./img/upload-pgyer-3.png)

environment variables|explanation
----:|:----------
appKey|App Key
appType|Application type (1:iOS; 2: Android)
appIsLastest|Is it the latest version (1: yes; 2: no)
appFileSize|App file size
appName|App Name
appVersion|App Version
appVersionNo|For Android version Numbers, iOS is always 0
appBuildVersion|pgyer builds build Numbers that distinguish historical versions
appIdentifier|Application package name, iOS for BundleId, Android for package name
appIcon|Application the icon of the key, get the address http://o1wh05aeh.qnssl.com/image/view/app_icons/[appIcon]
appDescription|Introduction to the Application
appUpdateDescription|Application update description
appScreenshots|Application the screenshot of the key, get the address http://o1whyeemo.qnssl.com/image/view/app_screenshots/[appScreenshots]
appShortcutUrl|Application short links
appCreated|Application upload time
appUpdated|Application update time
appQRCodeURL|Application the qr code address
appPgyerURL|Application pgyer url
appBuildURL|Application build pgyer url
56 changes: 56 additions & 0 deletions README_cn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
[![license](https://img.shields.io/github/license/mashape/apistatus.svg)](http://opensource.org/licenses/MIT)&#8194;&#8194;
[![upload-pgyer](https://img.shields.io/badge/upload--pgyer-1.24-brightgreen.svg)](https://github.com/myroid/jenkins-upload-pgyer-plugin)&#8194;&#8194;
[![downloads](https://img.shields.io/badge/downloads-%3C1K-orange.svg)](https://github.com/myroid/jenkins-upload-pgyer-plugin)&#8194;&#8194;
[![blog](https://img.shields.io/badge/blog-dafan.tech-red.svg)](http://dafan.tech)

### upload-pgyer-jenkins-plugin

蒲公英官方网址 [https://www.pgyer.com/](https://www.pgyer.com/)

蒲公英平台可以让开发者和企业将应用上传到网站,生成安装链接和二维码用户在手机上打开安装链接,或扫码二维码,即可开始安装!

因此,这款upload-pgyer的Jenkins插件可以让开发者将apk/ipa文件上传到蒲公英平台!**并且这款插件可以将蒲公英平台返回的应用信息解析后注入到Jenkins的全局变量中,这样你就可以很方便的在其他构建步骤中使用这些返回的信息**,你可以在Jenkins的job配置页面的`构建``构建后操作`这两个操作中点击添加构建步骤选择`upload to pgyer`。然后你就可以看到类似下面图片的操作界面:

Screenshot
![](./img/upload-pgyer.png)

需要填写的字段|字段的解释
----:|:----------
pgyer uKey|`(必填)` 用户Key,用来标识当前用户的身份,<br/>对于同一个蒲公英的注册用户来说,这个值在固定的。<br/>[点击获取_ukey](https://www.pgyer.com/account/api)
pgyer api_key|(必填) API Key,用来识别API调用者的身份,<br/>如不特别说明,每个接口中都需要含有此参数。<br/>对于同一个蒲公英的注册用户来说,这个值在固定的。<br/>[点击获取_api_key](https://www.pgyer.com/account/api)
scandir|`(必填)` 需要上传的apk/ipa文件所在的文件夹或者父文件夹,<br/>当前默认路径是`${WORKSPACE}`,它代表了当前项目的绝对路径。<br/>这个功能的实现使用了ant框架的DirectoryScanner类,[点击查看DirectoryScanner类](https://ant.apache.org/manual/api/org/apache/tools/ant/DirectoryScanner.html),<br/>这个字段就是DirectoryScanner类中的basedir方法的参数[点击查看basedir方法](https://ant.apache.org/manual/api/org/apache/tools/ant/DirectoryScanner.html#basedir)
file wildcard|`(必填)` 需要上传的apk/ipa文件的名字,支持通配符,<br/>就像这样: **/Test?/*.apk,<br/>这个功能的实现使用了ant框架的DirectoryScanner类,[点击查看DirectoryScanner类](https://ant.apache.org/manual/api/org/apache/tools/ant/DirectoryScanner.html),<br/>这个字段就是DirectoryScanner类中的includes方法的参数,[点击查看includes方法](https://ant.apache.org/manual/api/org/apache/tools/ant/DirectoryScanner.html#includes)
installType|`(选填)` 应用安装方式,值为(1,2,3)。<br/>1:公开,2:密码安装,3:邀请安装。<br/>默认为1公开
password|`(选填)` 设置App安装密码,如果不想设置密码,请传空字符串,或不传。
updateDescription|`(选填)` 版本更新描述,请传空字符串,或不传。
qrcodePath|`(选填)` 如果你需要下载蒲公英返回的二维码,那么这里填写二维码的存储路径,<br/>如果你不需要下载,那么你不需要在这里填写任何内容。
envVarsPath |`(选填)` 如果你想存储蒲公英返回的上传信息,那么这里填写保存信息的文件路径,<br/>如果你不需要保存,那么你不需要在这里填写任何内容。

Running log
![](./img/upload-pgyer-2.png)

当你的应用上传成功后,在Jenkins中你就能看到上面图片中的信息。同时,你就可以在其他构建步骤中使用蒲公英返回来的信息,例如我的经验:

![](./img/upload-pgyer-3.png)

可以使用的环境变量|作用或解释
----:|:----------
appKey|App Key
appType|应用类型(1:iOS; 2:Android
appIsLastest|是否是最新版(1:是; 2:否)
appFileSize|App 文件大小
appName| 应用名称
appVersion|版本号
appVersionNo|适用于Android的版本编号,iOS始终为0
appBuildVersion|蒲公英生成的用于区分历史版本的build号
appIdentifier|应用程序包名,iOS为BundleId,Android为包名
appIcon|应用的Icon图标key,访问地址为 http://o1wh05aeh.qnssl.com/image/view/app_icons/[appIcon]
appDescription|应用介绍
appUpdateDescription|应用更新说明
appScreenshots|应用截图的key,获取地址为 http://o1whyeemo.qnssl.com/image/view/app_screenshots/[appScreenshots]
appShortcutUrl|应用短链接
appCreated|应用上传时间
appUpdated|应用更新时间
appQRCodeURL|应用二维码地址
appPgyerURL|应用主页地址
appBuildURL|本次上传的应用主页
Binary file added img/upload-pgyer-2.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/upload-pgyer-3.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/upload-pgyer.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
94 changes: 94 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<properties>
<jenkins.version>1.625.3</jenkins.version>
</properties>

<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>2.11</version>
<relativePath/>
</parent>

<groupId>ren.helloworld</groupId>
<artifactId>upload-pgyer</artifactId>
<version>1.24</version>
<packaging>hpi</packaging>
<name>Upload to pgyer</name>
<description>Upload to pgyer for jenkins plugin</description>
<url>https://wiki.jenkins.io/display/JENKINS/Upload+Pgyer+Plugin</url>

<licenses>
<license>
<name>MIT License</name>
<url>http://opensource.org/licenses/MIT</url>
</license>
</licenses>

<developers>
<developer>
<id>myroid</id>
<name>fan yang</name>
<email>myroid@foxmail.com</email>
<url>http://dafan.tech</url>
<organization>Micute</organization>
</developer>
</developers>

<organization>
<name>Micute</name>
<url>http://www.91ylian.com/</url>
</organization>

<repositories>
<repository>
<id>repo.jenkins-ci.org</id>
<url>https://repo.jenkins-ci.org/public/</url>
</repository>
</repositories>

<pluginRepositories>
<pluginRepository>
<id>repo.jenkins-ci.org</id>
<url>https://repo.jenkins-ci.org/public/</url>
</pluginRepository>
</pluginRepositories>

<dependencies>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>structs</artifactId>
<version>1.10</version>
</dependency>

<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.1</version>
</dependency>

<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
<version>1.9.9</version>
</dependency>

<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.10.3</version>
</dependency>
</dependencies>

<scm>
<connection>scm:git:ssh://github.com/jenkinsci/upload-pgyer-plugin.git</connection>
<developerConnection>scm:git:ssh://git@github.com/jenkinsci/upload-pgyer-plugin.git</developerConnection>
<url>https://github.com/jenkinsci/upload-pgyer-plugin</url>
<tag>HEAD</tag>
</scm>
</project>
36 changes: 36 additions & 0 deletions src/main/java/ren/helloworld/upload2pgyer/PublishEnvVarAction.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package ren.helloworld.upload2pgyer;

import hudson.EnvVars;
import hudson.model.AbstractBuild;
import hudson.model.EnvironmentContributingAction;
import hudson.model.InvisibleAction;

public class PublishEnvVarAction extends InvisibleAction implements EnvironmentContributingAction {
/**
* The environment variable key.
*/
private String key;

/**
* The environment variable value.
*/
private String value;

/**
* Constructor.
*
* @param key the environment variable key
* @param value the environment variable value
*/
public PublishEnvVarAction(String key, String value) {
this.key = key;
this.value = value;
}

/* (non-Javadoc)
* @see hudson.model.EnvironmentContributingAction#buildEnvVars(hudson.model.AbstractBuild, hudson.EnvVars)
*/
public void buildEnvVars(AbstractBuild<?, ?> build, EnvVars env) {
env.put(key, value);
}
}

0 comments on commit 90c731d

Please sign in to comment.