Skip to content

Commit

Permalink
Support publishing to Maven
Browse files Browse the repository at this point in the history
  • Loading branch information
GregDThomas committed Nov 15, 2020
1 parent 8a8c858 commit d8812a5
Show file tree
Hide file tree
Showing 4 changed files with 103 additions and 38 deletions.
51 changes: 43 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,67 @@
name: Gradle build

on: [push]
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/cache@v1
- uses: actions/cache@v2
if: always()
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle
path: |
~/.gradle/caches
~/.gradle/wrapper
./build
key: ${{ runner.os }}-gradle-${{ hashFiles('*.gradle') }}
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Build with Gradle
run: ./gradlew build
run: ./gradlew clean build
- name: Archive artifacts
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v2
with:
name: artifacts
path: build/libs
- name: Archive code reports
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v2
if: always()
with:
name: code-reports
path: build/reports
path: build/reports

publish:
runs-on: ubuntu-latest
needs: build
# if: ${{github.repository == 'igniterealtime/openfire-passwordreset-plugin' && github.ref == 'refs/heads/master' && github.event_name == 'push'}}
steps:
- uses: actions/checkout@v2
with:
# Defend against another commit quickly following the first
# We want the one that's been tested, rather than the head of master
ref: ${{ github.event.push.after }}
- uses: actions/cache@v2
if: always()
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
./build
key: ${{ runner.os }}-gradle-${{ hashFiles('*.gradle') }}
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Publish
run: ./gradlew publish
env:
IGNITE_REALTIME_MAVEN_USERNAME: ${{ secrets.IGNITE_REALTIME_MAVEN_USERNAME }}
IGNITE_REALTIME_MAVEN_PASSWORD: ${{ secrets.IGNITE_REALTIME_MAVEN_PASSWORD }}
29 changes: 28 additions & 1 deletion build.openfire-plugin.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ task openfirePluginAssembly(type: Jar, dependsOn: [jar]) {
from('src/plugin') {
filesMatching('plugin.xml') {
filter(ReplaceTokens, tokens: [
name : project.pluginName,
description : project.description,
version : project.version,
releaseDate : new Date().format("MM/dd/yyyy"),
minOpenfireVersion: minOpenfireVersion,
Expand Down Expand Up @@ -227,4 +229,29 @@ task deploy(dependsOn: [copyNewPlugin]) {
println(' installed')
}
}
}
}

publishing {
publications {
mavenJava(MavenPublication) {
from components.java
artifact source: openfirePluginAssembly
pom {
name = project.name
description = project.description
url = 'https://igniterealtime.org/projects/openfire/plugin-archive.jsp?plugin=' + project.name
}
}
}
repositories {

maven {
credentials {
username System.getenv("IGNITE_REALTIME_MAVEN_USERNAME")
password System.getenv("IGNITE_REALTIME_MAVEN_PASSWORD")
}
url 'https://igniterealtime.org/archiva/repository/maven/'
}
}
}
tasks.publish.dependsOn check
5 changes: 4 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
minOpenfireVersion=4.5.0
version=0.0.1-SNAPSHOT
version=0.0.1-SNAPSHOT
name=PasswordReset
description=Provides the ability for users to reset their own passwords if they have forgotten them.
pluginName=Password Reset
56 changes: 28 additions & 28 deletions src/plugin/plugin.xml
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>

<plugin>
<class>org.jivesoftware.openfire.plugin.passwordreset.PasswordResetPlugin</class>
<name>Password Reset</name>
<description><![CDATA[
Provides the ability for users to reset their own passwords if they have forgotten them.
]]></description>
<author>Ignite Realtime</author>
<version>@version@</version>
<date>@releaseDate@</date>
<minServerVersion>@minOpenfireVersion@</minServerVersion>
<minJavaVersion>@javaVersion@</minJavaVersion>
<databaseKey>password-reset</databaseKey>
<databaseVersion>1</databaseVersion>

<adminconsole>
<tab id="tab-server">
<sidebar id="sidebar-server-settings">
<item id="password-reset-conf"
name="${passwordreset.sidebar-name}"
url="settings.jsp"
description="${passwordreset.sidebar-description}"/>
</sidebar>
</tab>
</adminconsole>

</plugin>
<?xml version="1.0" encoding="UTF-8"?>

<plugin>
<class>org.jivesoftware.openfire.plugin.passwordreset.PasswordResetPlugin</class>
<name>@name@</name>
<description><![CDATA[
@description@
]]></description>
<author>Ignite Realtime</author>
<version>@version@</version>
<date>@releaseDate@</date>
<minServerVersion>@minOpenfireVersion@</minServerVersion>
<minJavaVersion>@javaVersion@</minJavaVersion>
<databaseKey>password-reset</databaseKey>
<databaseVersion>1</databaseVersion>

<adminconsole>
<tab id="tab-server">
<sidebar id="sidebar-server-settings">
<item id="password-reset-conf"
name="${passwordreset.sidebar-name}"
url="settings.jsp"
description="${passwordreset.sidebar-description}"/>
</sidebar>
</tab>
</adminconsole>

</plugin>

0 comments on commit d8812a5

Please sign in to comment.