diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 0ad12d5..82d5030 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -22,7 +22,7 @@ jobs:
- name: Set up JDK
uses: actions/setup-java@v3
with:
- java-version: '18'
+ java-version: '21'
distribution: 'temurin'
- name: Cache SonarCloud packages
diff --git a/.github/workflows/docker-build-push.yml b/.github/workflows/docker-build-push.yml
new file mode 100644
index 0000000..44e6e07
--- /dev/null
+++ b/.github/workflows/docker-build-push.yml
@@ -0,0 +1,92 @@
+name: Gameyfin Docker Build & Push
+
+on:
+ workflow_dispatch:
+ inputs:
+ branch:
+ description: "The branch to checkout when cutting the release."
+ required: true
+ default: "main"
+ tag:
+ description: "Docker image tag."
+ required: true
+ default: "X.Y.Z"
+
+jobs:
+ release:
+ runs-on: ubuntu-latest
+ name: Release
+ steps:
+ - name: Git checkout
+ uses: actions/checkout@v4
+ with:
+ ref: ${{ github.event.inputs.branch }}
+
+ - name: Set up JDK
+ uses: actions/setup-java@v3
+ with:
+ java-version: '21'
+ distribution: 'temurin'
+ cache: 'maven'
+
+ - name: Configure Git User
+ run: |
+ git config user.email "actions@github.com"
+ git config user.name "GitHub Actions"
+
+ - name: Maven Package
+ run: mvn package -B -s .maven_settings.xml -DreleaseVersion=${{ github.event.inputs.tag }} -Darguments="-Dmaven.deploy.skip=true -Dmaven.test.skip=true -Dmaven.javadoc.skip=true"
+ env:
+ GITHUB_ACTOR: ${{ github.actor }}
+ GITHUB_TOKEN: ${{ github.token }}
+
+ - name: Docker meta
+ id: meta
+ uses: docker/metadata-action@v5
+ with:
+ images: |
+ grimsi/gameyfin
+ tags: |
+ type=semver,pattern={{version}},value=${{ github.event.inputs.tag }}
+ type=semver,pattern={{major}}.{{minor}},value=${{ github.event.inputs.tag }}
+ type=semver,pattern={{major}},value=${{ github.event.inputs.tag }}
+
+ - name: Set up QEMU
+ uses: docker/setup-qemu-action@v3
+
+ - name: Set up Docker Buildx
+ uses: docker/setup-buildx-action@v3
+
+ - name: Cache Docker layers
+ uses: actions/cache@v3
+ with:
+ path: /tmp/.buildx-cache
+ key: ${{ runner.os }}-buildx-${{ github.sha }}
+ restore-keys: |
+ ${{ runner.os }}-buildx-
+
+ - name: Login to Docker Hub
+ uses: docker/login-action@v3
+ with:
+ username: ${{ secrets.DOCKERHUB_USERNAME }}
+ password: ${{ secrets.DOCKERHUB_TOKEN }}
+
+ - name: Build and push
+ uses: docker/build-push-action@v5
+ with:
+ context: .
+ file: ./docker/Dockerfile
+ platforms: linux/amd64,linux/arm64
+ push: true
+ tags: ${{ steps.meta.outputs.tags }}
+ labels: ${{ steps.meta.outputs.labels }}
+ cache-from: type=local,src=/tmp/.buildx-cache
+ cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
+
+ - # Temp fix
+ # https://github.com/docker/build-push-action/issues/252
+ # https://github.com/moby/buildkit/issues/1896
+ name: Move Docker cache (temp fix)
+ run: |
+ rm -rf /tmp/.buildx-cache
+ mv /tmp/.buildx-cache-new /tmp/.buildx-cache
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 9223227..c447827 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -98,6 +98,7 @@ jobs:
with:
context: .
file: ./docker/Dockerfile
+ platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
diff --git a/backend/pom.xml b/backend/pom.xml
index 934e49d..8285f00 100644
--- a/backend/pom.xml
+++ b/backend/pom.xml
@@ -13,7 +13,7 @@
jar
- 18
+ 21
1.7.0
2.1.0
diff --git a/backend/src/main/java/de/grimsi/gameyfin/config/properties/GameyfinProperties.java b/backend/src/main/java/de/grimsi/gameyfin/config/properties/GameyfinProperties.java
index 7444993..ce83f00 100644
--- a/backend/src/main/java/de/grimsi/gameyfin/config/properties/GameyfinProperties.java
+++ b/backend/src/main/java/de/grimsi/gameyfin/config/properties/GameyfinProperties.java
@@ -6,6 +6,8 @@ import java.util.List;
// see https://stackoverflow.com/questions/26699385/spring-boot-yaml-configuration-for-a-list-of-strings
@ConfigurationProperties("gameyfin")
+// Technically SonarQube is correct, but I like to keep the lowercase method names since it correlates better with the config keys
+@SuppressWarnings("java:S3010")
public record GameyfinProperties(
folders folders,
List fileExtensions,
diff --git a/backend/src/main/java/de/grimsi/gameyfin/util/FilenameUtil.java b/backend/src/main/java/de/grimsi/gameyfin/util/FilenameUtil.java
index 6e75f29..36b29d0 100644
--- a/backend/src/main/java/de/grimsi/gameyfin/util/FilenameUtil.java
+++ b/backend/src/main/java/de/grimsi/gameyfin/util/FilenameUtil.java
@@ -2,7 +2,6 @@ package de.grimsi.gameyfin.util;
import de.grimsi.gameyfin.config.properties.GameyfinProperties;
import org.apache.commons.io.FilenameUtils;
-import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.nio.file.Files;
@@ -18,8 +17,14 @@ public class FilenameUtil {
private static List possibleGameFileSuffixes;
// matches v1.1.1 v1.1 v1 version numbers
private static final Pattern versionPattern = Pattern.compile("v(\\d+\\.)?(\\d+\\.)?(\\d+)");
- private static final Pattern trailingNoisePattern = Pattern.compile("( |\\(\\)|\\[\\]|[-_.])+$");
- private static final Pattern headingNoisePattern = Pattern.compile("^( |\\(\\)|\\[\\]|[-_.])+");
+
+ // Suppress SONAR detecting this as a potential stack overflow
+ // SONAR is correct, but I honestly don't know how to fix it
+ // Also it would require 6k+ character long filenames to really overflow the JVM stack
+ @SuppressWarnings("java:S5998")
+ private static final Pattern trailingNoisePattern = Pattern.compile("( |\\(\\)|\\[]|[-_.])+$");
+ @SuppressWarnings("java:S5998")
+ private static final Pattern headingNoisePattern = Pattern.compile("^( |\\(\\)|\\[]|[-_.])+");
public FilenameUtil(GameyfinProperties gameyfinProperties) {
possibleGameFileExtensions = gameyfinProperties.fileExtensions();
@@ -29,18 +34,11 @@ public class FilenameUtil {
possibleGameFileSuffixes.sort((s1,s2) -> Integer.compare(s2.length(), s1.length()));
}
- @Value("${gameyfin.file-suffixes}")
- public void setPossibleGameFileSuffixes(List possibleGameFileSuffixes) {
- // Sort in descending length, so for example "windows" gets checked before "win"
- possibleGameFileSuffixes.sort((s1,s2) -> Integer.compare(s2.length(), s1.length()));
- FilenameUtil.possibleGameFileSuffixes = possibleGameFileSuffixes;
- }
-
public static String getFilenameWithoutExtension(Path p) {
// If the path points to a folder, return the folder name
// Folders like "Counter Strike 1.6" would otherwise be returned as "Counter Strike 1"
- if(Files.isDirectory(p)) return FilenameUtils.getName(p.toString());
+ if (Files.isDirectory(p)) return FilenameUtils.getName(p.toString());
return FilenameUtils.getBaseName(p.toString());
}
@@ -68,7 +66,7 @@ public class FilenameUtil {
public static String removePattern(String string, Pattern pattern) {
Matcher matcher = pattern.matcher(string);
- if(matcher.find()) {
+ if (matcher.find()) {
return matcher.replaceAll("");
}
return string;
diff --git a/frontend/package-lock.json b/frontend/package-lock.json
index 291d009..1678908 100644
--- a/frontend/package-lock.json
+++ b/frontend/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "frontend",
- "version": "1.4.0-SNAPSHOT",
+ "version": "1.4.2-SNAPSHOT",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "frontend",
- "version": "1.4.0-SNAPSHOT",
+ "version": "1.4.2-SNAPSHOT",
"dependencies": {
"@angular/animations": "^16.2.8",
"@angular/cdk": "^16.2.7",
diff --git a/frontend/package.json b/frontend/package.json
index 1f07d79..c80b151 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -1,6 +1,6 @@
{
"name": "frontend",
- "version": "1.4.0-SNAPSHOT",
+ "version": "1.4.2-SNAPSHOT",
"scripts": {
"ng": "ng",
"start": "ng serve",
diff --git a/frontend/pom.xml b/frontend/pom.xml
index ca8719e..d2ee3e0 100644
--- a/frontend/pom.xml
+++ b/frontend/pom.xml
@@ -49,7 +49,7 @@
install-node-and-npm
- v18.18.0
+ v20.8.1