diff --git a/.github/workflows/deploy-release.yaml b/.github/workflows/deploy-release.yaml new file mode 100644 index 0000000000000000000000000000000000000000..bbfcb2eb1fab531d17e0e1c42fad2448d7935d24 --- /dev/null +++ b/.github/workflows/deploy-release.yaml @@ -0,0 +1,34 @@ +name: Build Release + +on: + push: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + if: "!contains(github.event.head_commit.message, '[ci skip]')" + + steps: + - uses: actions/checkout@v1 + + - name: Build and Test + uses: qcastel/github-actions-maven-cmd@master + with: + maven-args: "clean install" + + - name: Release + uses: qcastel/github-actions-maven-release@master + env: + JAVA_HOME: /usr/lib/jvm/java-11-openjdk/ + with: + git-release-bot-name: "bot-idhub" + git-release-bot-email: "bot@idhub.io" + version-minor: true + maven-development-version-number: ${parsedVersion.majorVersion}.\${parsedVersion.nextMinorVersion}-SNAPSHOT + maven-release-version-number: ${parsedVersion.majorVersion}.\${parsedVersion.minorVersion}.0 + + + maven-args: "-Dmaven.javadoc.skip=true -DskipTests -DskipITs -Dmaven.deploy.skip=true" + ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8728f0b5af2f9420ec523e92ea325a0349d0e91b..0004d073a45edaad8b256fb85874877b8ee3ed47 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,33 +1,12 @@ -# This file is a template, and might need editing before it works on your project. -# To contribute improvements to CI/CD templates, please follow the Development guide at: -# https://docs.gitlab.com/ee/development/cicd/templates.html -# This specific template is located at: -# https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Maven.gitlab-ci.yml - # Build JAVA applications using Apache Maven (http://maven.apache.org) -# For docker image tags see https://hub.docker.com/_/maven/ -# -# For general lifecycle information see https://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html - -# This template will build and test your projects -# * Caches downloaded dependencies and plugins between invocation. -# * Verify but don't deploy merge requests. -# * Deploy built artifacts from master branch only. variables: - # This will suppress any download for dependencies and plugins or upload messages which would clutter the console log. - # `showDateTime` will show the passed time in milliseconds. You need to specify `--batch-mode` to make this work. MAVEN_OPTS: "-Dhttps.protocols=TLSv1.2 -Dmaven.repo.local=$CI_PROJECT_DIR/.m2/repository -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN -Dorg.slf4j.simpleLogger.showDateTime=true -Djava.awt.headless=true" - # As of Maven 3.3.0 instead of this you may define these options in `.mvn/maven.config` so the same config is used - # when running from the command line. # `installAtEnd` and `deployAtEnd` are only effective with recent version of the corresponding plugins. - MAVEN_CLI_OPTS: "--batch-mode --errors --fail-at-end --show-version -DinstallAtEnd=true -DdeployAtEnd=true" + MAVEN_CLI_OPTS: "--batch-mode --errors --fail-at-end --show-version -DinstallAtEnd=true -DdeployAtEnd=true -Dmaven.test.skip" -# This template uses jdk11 for verifying and deploying images image: maven:3-jdk-11 -# Cache downloaded dependencies and plugins between builds. -# To keep cache across branches add 'key: "$CI_JOB_NAME"' cache: paths: - .m2/repository @@ -46,17 +25,13 @@ cache: verify:jdk11: <<: *verify -# To deploy packages from CI, create a ci_settings.xml file -# For deploying packages to GitLab's Maven Repository: See https://docs.gitlab.com/ee/user/packages/maven_repository/index.html#create-maven-packages-with-gitlab-cicd for more details. -# Please note: The GitLab Maven Repository is currently only available in GitLab Premium / Ultimate. -# For `master` branch run `mvn deploy` automatically. build:jdk11: stage: build script: - if [ ! -f ci_settings.xml ]; then echo "CI settings missing\! If deploying to GitLab Maven Repository, please see https://docs.gitlab.com/ee/user/packages/maven_repository/index.html#create-maven-packages-with-gitlab-cicd for instructions."; fi - - 'mvn $MAVEN_CLI_OPTS clean -Dmaven.test.skip package -s ci_settings.xml' + - 'mvn $MAVEN_CLI_OPTS clean package -s ci_settings.xml' only: variables: - $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH diff --git a/target/discordaction-1.0.0.jar b/builds/discordaction-1.0.0.jar similarity index 61% rename from target/discordaction-1.0.0.jar rename to builds/discordaction-1.0.0.jar index 092104f4444ad98dc25648b17758ffc075f4da8e..e4385fd45be3affd224f2be8121d737d8f757a82 100644 Binary files a/target/discordaction-1.0.0.jar and b/builds/discordaction-1.0.0.jar differ diff --git a/builds/discordaction-1.1.0.jar b/builds/discordaction-1.1.0.jar new file mode 100644 index 0000000000000000000000000000000000000000..893dd1aa910d063286c18069c1a51ab9c07d7a23 Binary files /dev/null and b/builds/discordaction-1.1.0.jar differ diff --git a/ci_settings.xml b/ci_settings.xml index 8e9309544fef8584851990c358cde57dc62cfc08..8340080ac9300fe141d7a1e5c3a149f2958a3241 100644 --- a/ci_settings.xml +++ b/ci_settings.xml @@ -7,7 +7,7 @@ <httpHeaders> <property> <name>Job-Token</name> - <value>com.stream_pi.discordaction</value> + <value>com.miniontoby.discordaction</value> </property> </httpHeaders> </configuration> diff --git a/pom.xml b/pom.xml index aeddf2cd5ebb2974d3a872517347addb6c8e8429..5c6b763bf3c8f930e396983183d0833fcea1029e 100644 --- a/pom.xml +++ b/pom.xml @@ -4,9 +4,17 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.stream-pi</groupId> + <groupId>com.miniontoby</groupId> <artifactId>discordaction</artifactId> - <version>1.0.0</version> + <version>1.1.0</version> + + <distributionManagement> + <repository> + <id>github</id> + <name>Github</name> + <url>https://maven.pkg.github.com/Miniontoby/DiscordAction</url> + </repository> + </distributionManagement> <build> <plugins> @@ -42,6 +50,8 @@ <maven.compiler.source>11</maven.compiler.source> <maven.compiler.target>11</maven.compiler.target> <JavaFXVersion>16-ea+5</JavaFXVersion> + <github.global.server>github</github.global.server> + <project.scm.id>github</project.scm.id> </properties> <dependencies> diff --git a/src/main/java/com/stream_pi/discordaction/DiscordAction.java b/src/main/java/com/miniontoby/discordaction/DiscordAction.java similarity index 77% rename from src/main/java/com/stream_pi/discordaction/DiscordAction.java rename to src/main/java/com/miniontoby/discordaction/DiscordAction.java index 1d5cae4caa97d0c20074a305f5222dea0040a829..3c5f5eb7c42c21cb4a57adb077793bcb605e6b28 100644 --- a/src/main/java/com/stream_pi/discordaction/DiscordAction.java +++ b/src/main/java/com/miniontoby/discordaction/DiscordAction.java @@ -30,13 +30,16 @@ public class DiscordAction extends NormalAction { Property usernameProperty = new StringProperty("username"); usernameProperty.setDisplayName("Webhook Username"); + Property contentProperty = new StringProperty("content"); + contentProperty.setDisplayName("Message Content"); + Property titleProperty = new StringProperty("title"); - titleProperty.setDisplayName("Webhook Title"); + titleProperty.setDisplayName("Embed Title"); - Property contentProperty = new StringProperty("content"); - contentProperty.setDisplayName("Webhook Text Content"); + Property descriptionProperty = new StringProperty("description"); + descriptionProperty.setDisplayName("Embed Description"); - addClientProperties(webhookURLProperty, usernameProperty, titleProperty, contentProperty); + addClientProperties(webhookURLProperty, usernameProperty, contentProperty, titleProperty, descriptionProperty); } @Override @@ -46,9 +49,10 @@ public class DiscordAction extends NormalAction { public void sendMessage() throws MinorException { String webhookURL = getClientProperties().getSingleProperty("webhook_url").getStringValue(); - String webhookTitle = getClientProperties().getSingleProperty("title").getStringValue(); String webhookUser = getClientProperties().getSingleProperty("username").getStringValue(); String webhookContent = getClientProperties().getSingleProperty("content").getStringValue(); + String webhookEmbedTitle = getClientProperties().getSingleProperty("title").getStringValue(); + String webhookEmbedDescription = getClientProperties().getSingleProperty("description").getStringValue(); if (webhookURL.isBlank()) { throwMinorException("No Discord Webhook URL specified!"); @@ -56,10 +60,11 @@ public class DiscordAction extends NormalAction { DiscordWebhook webhook = new DiscordWebhook(webhookURL); webhook.setUsername(webhookUser); + webhook.setContent(webhookContent); DiscordWebhook.EmbedObject embed = new DiscordWebhook.EmbedObject(); - embed.setTitle(webhookTitle); - embed.setDescription(webhookContent); + embed.setTitle(webhookEmbedTitle); + embed.setDescription(webhookEmbedDescription); try { webhook.addEmbed(embed); diff --git a/src/main/java/com/stream_pi/discordaction/DiscordWebhook.java b/src/main/java/com/miniontoby/discordaction/DiscordWebhook.java similarity index 100% rename from src/main/java/com/stream_pi/discordaction/DiscordWebhook.java rename to src/main/java/com/miniontoby/discordaction/DiscordWebhook.java diff --git a/target/classes/com/stream_pi/discordaction/DiscordAction.class b/target/classes/com/stream_pi/discordaction/DiscordAction.class index c9e56ad7431cac9e229d96fb588cb9aa89505e14..6674f3a1aaa6dda2828f8e88c308491c3cc939c7 100644 Binary files a/target/classes/com/stream_pi/discordaction/DiscordAction.class and b/target/classes/com/stream_pi/discordaction/DiscordAction.class differ diff --git a/target/discordaction-1.1.0.jar b/target/discordaction-1.1.0.jar new file mode 100644 index 0000000000000000000000000000000000000000..893dd1aa910d063286c18069c1a51ab9c07d7a23 Binary files /dev/null and b/target/discordaction-1.1.0.jar differ diff --git a/target/maven-archiver/pom.properties b/target/maven-archiver/pom.properties index 73e2c0856f0d2c8cabf9ba9488adbf61201ba42b..3e0e1b87a65f115bdff9ff84c414b21e71d49f09 100644 --- a/target/maven-archiver/pom.properties +++ b/target/maven-archiver/pom.properties @@ -1,4 +1,4 @@ #Created by Apache Maven 3.8.4 -groupId=com.stream-pi +groupId=com.miniontoby artifactId=discordaction -version=1.0.0 +version=1.1.0 diff --git a/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst index f00f2ffccc255dbf8df399f3d27c1ccf27f35316..49a4fedcc37ed18fb26de851eac555a0f3f98119 100644 --- a/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst +++ b/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst @@ -1,3 +1,3 @@ -/home/pi/discordaction/src/main/java/com/stream_pi/discordaction/DiscordAction.java /home/pi/discordaction/src/main/java/module-info.java -/home/pi/discordaction/src/main/java/com/stream_pi/discordaction/DiscordWebhook.java +/home/pi/discordaction/src/main/java/com/miniontoby/discordaction/DiscordAction.java +/home/pi/discordaction/src/main/java/com/miniontoby/discordaction/DiscordWebhook.java