2012-03-12 22 views
0

githubからプロジェクトをプルダウンしてビルドし、ビルドのステータスを報告するシンプルなJenkinsのビルドがあります。Jenkinsのビルドが成功したときにjarをgithubにプッシュ

結果JARファイルをプロジェクトのTARGET-SNAPSHOTSブランチに公開するようにJenkinsを設定したいとします。

現在、私のプロジェクトの.gitignoreの/ターゲット/ *

私はGitPublisherを見ていたが、これはむしろちょうどjarファイルよりも、全体のビルドを押し出すように見えます。

これを行う最善の方法について/考えられますか?

ありがとうございました

+0

プロジェクトをビルドするMavenを使用していますか? –

+0

既存のレポにファイルを追加してその変更をプッシュしようとしていますか、GitHubのダウンロードセクションにファイルを追加していますか? –

+0

@brian - はい - 私はプロジェクトをビルドするためにmavenを使用しています。 – empire29

答えて

1

、あなたはgithubののダウンロードセクションが許容され、あなたが使用することができます言った:他の

find . -name "*.jar" -exec scp {} [email protected]:/path/for/build/${BUILD_TAG} \; 

をgithubはプラグイン - https://github.com/github/maven-pluginsをダウンロードします。私はビルドの一環としてRiak Javaクライアントをダウンロードセクションに配備するためにこれを使用します。

あなたが必要あなたの〜/ .m2/settings.xml内

<settings> 
    <profiles> 
    <profile> 
     <id>github</id> 
     <properties> 
     <github.global.userName>YourGithubUser</github.global.userName> 
     <github.global.password>YourGithubPass</github.global.password> 
     </properties> 
    </profile> 
    </profiles> 
    <activeProfiles> 
    <activeProfile>github</activeProfile> 
    </activeProfiles> 
</settings> 

はその後のようなプロジェクトの.pom何かに:

<profile> 
    <id>githubUpload</id> 
    <activation> 
    <property> 
     <name>github.downloads</name> 
     <value>true</value> 
    </property> 
    </activation> 
    <build> 
    <plugins> 
     <plugin> 
     <groupId>com.github.github</groupId> 
     <artifactId>downloads-maven-plugin</artifactId> 
     <version>0.4</version> 
     <configuration> 
      <description>${project.version} release of ${project.name}</description> 
      <override>false</override>    
      <includeAttached>true</includeAttached> 
     </configuration> 
     <executions> 
      <execution> 
      <goals> 
       <goal>upload</goal> 
      </goals> 
      <phase>install</phase> 
      </execution> 
     </executions> 
     </plugin> 
    </plugins> 
    </build> 
</profile> 

(Iはインストールの一部としてそれをやっています相 - あなたはしかし、あなたが好きな操作を行うことができます)

そして、単にあなたのMavenのビルドに-Dgithub.downloads=trueを追加 -

mvn install -Dgithub.downloads=true

プラグインのWebページ等のファイルを除外/含めるためのすべてのオプションを、一覧表示されます

2

あなたは多くの可能性があると思います。その1つは、ビルド後のスクリプトを実行することです。書き込むことができるのはシェルです。

Post build task

簡単なスクリプトを参照してください:あなたはMavenを使っているので

Publish Over ... (ssh, ftp, cifs)

+0

私は試してみます - あなたはSCPをgithubにすることができませんでした。ありがとう – empire29

関連する問題