diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml new file mode 100644 index 0000000..c5ed5be --- /dev/null +++ b/.gitea/workflows/deploy.yml @@ -0,0 +1,38 @@ +name: Deploy + +on: + push: + branches: ["master"] + paths: [".gitea/workflows/deploy-api.yml", "API/**", "!API/README.md"] + +jobs: + docker: + strategy: + matrix: + java-version: ["17"] + maven-version: ["3.8.5"] + runs-on: "ubuntu-latest" + defaults: + run: + working-directory: "./API" + + # Steps to run + steps: + # Checkout the repo + - name: Checkout + uses: actions/checkout@v4 + + # Setup Java and Maven + - name: Set up JDK and Maven + uses: s4u/setup-maven-action@v1.12.0 + with: + java-version: ${{ matrix.java-version }} + distribution: "zulu" + maven-version: ${{ matrix.maven-version }} + + # Deploy to Dokku + - name: Deploy to Dokku + uses: dokku/github-action@master + with: + git_remote_url: "ssh://dokku@10.10.3.28:22/textpurify-api" + ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY }} diff --git a/API/src/main/java/me/braydon/profanity/notification/NotificationSource.java b/API/src/main/java/me/braydon/profanity/notification/NotificationSource.java new file mode 100644 index 0000000..3b5ea87 --- /dev/null +++ b/API/src/main/java/me/braydon/profanity/notification/NotificationSource.java @@ -0,0 +1,13 @@ +package me.braydon.profanity.notification; + +/** + * A source that can receive notifications. + * + * @author Braydon + */ +public abstract class NotificationSource { + /** + * Send an alert to this notification source. + */ + public abstract void alert(); +} \ No newline at end of file diff --git a/API/src/main/java/me/braydon/profanity/notification/impl/DiscordSource.java b/API/src/main/java/me/braydon/profanity/notification/impl/DiscordSource.java new file mode 100644 index 0000000..71d0134 --- /dev/null +++ b/API/src/main/java/me/braydon/profanity/notification/impl/DiscordSource.java @@ -0,0 +1,25 @@ +package me.braydon.profanity.notification.impl; + +import lombok.AllArgsConstructor; +import lombok.NonNull; +import me.braydon.profanity.notification.NotificationSource; + +/** + * A notification source that + * sends alerts to a Discord webhook. + * + * @author Braydon + */ +@AllArgsConstructor +public final class DiscordSource extends NotificationSource { + /** + * The URL of the webhook to send alerts to. + */ + @NonNull private final String webhookUrl; + + /** + * Send an alert to this notification source. + */ + @Override + public void alert() {} +} \ No newline at end of file