DA
daggerok/github-release-plugin-example
de.jutzig/github-release-plugin usage. real-world example: https://github.com/daggerok/streaming-file-server/blob/master/pom.xml
= github-release-plugin-example
== configuration
.add plugin configuration in deploy phase:
[source,xml]
de.jutzig
github-release-plugin
1.1.1
<!-- publish release on deploy phase -->
<executions>
<execution>
<id>release</id>
<phase>deploy</phase>
</execution>
</executions>
<configuration>
<releaseName>v${project.version}</releaseName>
<tag>${project.version}</tag>
<!-- re-release same version (not fail if relase exists) -->
<overwriteArtifact>true</overwriteArtifact>
<!-- in fileSets add all files you wanna release: -->
<fileSets>
<fileSet>
<directory>${project.basedir}/scripts</directory>
<includes>
<include>application*.bash</include>
<include>application*.cmd</include>
</includes>
</fileSet>
<fileSet>
<directory>${project.basedir}/modules/docker/postgres</directory>
<includes>
<include>docker-compose.yml</include>
</includes>
</fileSet>
<fileSet>
<directory>${project.basedir}/modules/apps/file-items-service/build/libs</directory>
<includes>
<include>*.jar</include>
</includes>
</fileSet>
<fileSet>
<directory>${project.basedir}/modules/apps/file-server/build/libs</directory>
<includes>
<include>*.jar</include>
</includes>
</fileSet>
</fileSets>
</configuration>
</plugin>
----
.important: add to pom.xml file proper configurations (connection url proto must be https, not git if you are using username / password credentials):
[source,xml]
scm:git:https://github.com/daggerok/streaming-file-server.git
https://github.com/daggerok/streaming-file-server.git
scm:git:git@github.com:daggerok/streaming-file-server.git
HEAD
.finally update your ~/.m2/settings.xml file: put here your github credentials for server github
[source,xml]
github
GITHUB_USERNAME
GITHUB_PASSWORD
----
== usage
.we need maven goal de.jutzig:github-release-plugin:1.1.1:release
[source,bash]
./mvnw de.jutzig:github-release-plugin:1.1.1:release
== tips
=== default goals
.to simplify command just add default goal, so maven will execute it for you automatically
[source,xml]
exec:exec de.jutzig:github-release-plugin:1.1.1:release
.now, for release you can just use maven wrapper with no arguments, like so:
[source,bash]
./mvnw
=== override username / password on runtime
.set username / password for publishing release to gituhb:
[source,bash]
./mvnw -Dusername=ololo -Dpassword=trololo
=== draft release
.to creates the release in draft state, run command:
[source,bash]
./mvnw -Dgithub.draft=true
=== windows / unix profiles
Lets assume for project build we are isong different commands / shell scripts
for different systems, such as windows, linux, mac os x...
.windows
[source,cmd]
gradlew.bat clean build
.non windows (linux, mac, etc...)
[source,bash]
./gradlew clean build
so before release we need build project with there commands depends on OS we are working.
to do so we can introduse maven profiles and use proper scripts bor build refore release:
.pom.xml
[source,xml]
org.codehaus.mojo
exec-maven-plugin
1.6.0
compile-gradle
initialize
exec
${gradle.executable}
clean
build
<plugin>
<groupId>de.jutzig</groupId>
<artifactId>github-release-plugin</artifactId>
<version>1.1.1</version>
<executions>
<execution>
<id>release</id>
<phase>deploy</phase>
</execution>
</executions>
<configuration>
<overwriteArtifact>true</overwriteArtifact>
<description>${project.artifactId} release</description>
<releaseName>v${project.version}</releaseName>
<tag>${project.version}</tag>
<fileSets>
<fileSet>
<directory>${project.basedir}/scripts</directory>
<includes>
<include>application*.bash</include>
<include>application*.cmd</include>
</includes>
</fileSet>
<fileSet>
<directory>${project.basedir}/modules/docker/postgres</directory>
<includes>
<include>docker-compose.yml</include>
</includes>
</fileSet>
<fileSet>
<directory>${project.basedir}/modules/apps/file-items-service/build/libs</directory>
<includes>
<include>*.jar</include>
</includes>
</fileSet>
<fileSet>
<directory>${project.basedir}/modules/apps/file-server/build/libs</directory>
<includes>
<include>*.jar</include>
</includes>
</fileSet>
</fileSets>
</configuration>
</plugin>
win
Windows
gradlew.bat
nix
unix
./gradlew
----
links:
- link:https://github.com/jutzig/github-release-plugin[plugin home page]
- link:https://github.com/daggerok/streaming-file-server/blob/master/pom.xml[real world usage example]
On this page
Contributors
MIT License
Created June 29, 2018
Updated June 29, 2018