impl ci
Some checks failed
Deploy to Dokku / docker (ubuntu-latest) (push) Has been cancelled

This commit is contained in:
Lee 2024-06-24 15:45:53 +01:00
parent ac3529ed88
commit b703f51868
6 changed files with 87 additions and 24 deletions

31
.gitea/workflows/ci.yml Normal file
View File

@ -0,0 +1,31 @@
name: Deploy to Dokku
on:
push:
branches: ["master"]
paths-ignore:
- .gitignore
- README.md
- LICENSE
jobs:
docker:
strategy:
matrix:
arch: ["ubuntu-latest"]
runs-on: ${{ matrix.arch }}
# Steps to run
steps:
# Checkout the repo
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
# Deploy to Dokku
- name: Push to dokku
uses: dokku/github-action@master
with:
git_remote_url: "ssh://dokku@10.0.50.232:22/bat"
ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY }}

47
pom.xml
View File

@ -20,14 +20,57 @@
</properties>
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<!-- Used for compiling the source code with the proper Java version -->
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.13.0</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<!-- Enable incremental builds, this is reversed due to -->
<!-- a bug as seen in https://issues.apache.org/jira/browse/MCOMPILER-209 -->
<useIncrementalCompilation>false</useIncrementalCompilation>
</configuration>
</plugin>
<!-- Handles shading of dependencies in the final output jar -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.5.3</version>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- Specify the apps main class -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>cc.fascinated.bat.BatApplication</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<!-- Spring -->
<dependency>

View File

@ -1,16 +1,24 @@
package cc.fascinated.bat.common;
import java.text.DecimalFormat;
import java.text.NumberFormat;
/**
* @author Fascinated (fascinated7)
*/
public class NumberUtils {
/**
* Formats a number with commas.
* <p>
* Example: 1000 -> 1,000 | Example: 1000.5 -> 1,000.5
* </p>
*
* @param number the number to format
* @return the formatted number
*/
public static String formatNumberCommas(double number) {
return String.format("%,.0f", number);
NumberFormat format = NumberFormat.getNumberInstance();
format.setGroupingUsed(true);
return format.format(number);
}
}

View File

@ -98,13 +98,7 @@ public class CommandService extends ListenerAdapter {
});
// Register all commands
for (BatCommand command : commands.values()) {
if (command.getCommandData() == null) {
continue;
}
jda.upsertCommand(command.getCommandData()).complete(); // Register the command on Discord
}
jda.updateCommands().addCommands(commands.values().stream().map(BatCommand::getCommandData).toList()).complete();
log.info("Registered all slash commands in {}ms", System.currentTimeMillis() - before);
}

View File

@ -10,5 +10,5 @@ spring:
# MongoDB Configuration
mongodb:
uri: "mongodb://bat:p4$$w0rd@localhost:27017"
database: "bonfire"
database: "bat"
auto-index-creation: true # Automatically create collection indexes

View File

@ -1,13 +0,0 @@
package cc.fascinated.bat;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class BatApplicationTests {
@Test
void contextLoads() {
}
}