mirror of
https://github.com/BrenBroZAYT/gameyfin.git
synced 2026-06-16 16:20:04 +00:00
@@ -0,0 +1,48 @@
|
|||||||
|
name: Gameyfin CI Pipeline
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
pull_request:
|
||||||
|
types: [opened, synchronize, reopened]
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
name: Build, Test & Scan
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: "!contains(github.event.head_commit.message, '[ci skip]')"
|
||||||
|
steps:
|
||||||
|
- name: Git checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Set up JDK
|
||||||
|
uses: actions/setup-java@v3
|
||||||
|
with:
|
||||||
|
java-version: '18'
|
||||||
|
distribution: 'temurin'
|
||||||
|
cache: 'maven'
|
||||||
|
|
||||||
|
- name: Extract Maven project version
|
||||||
|
id: project
|
||||||
|
run: echo "GAMEYFIN_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Show extracted Maven project version
|
||||||
|
run: echo "${{ steps.project.outputs.GAMEYFIN_VERSION }}"
|
||||||
|
|
||||||
|
- name: Maven build
|
||||||
|
run: mvn --batch-mode --update-snapshots package
|
||||||
|
|
||||||
|
- name: SonarQube scan
|
||||||
|
uses: kitabisa/sonarqube-action@v1.2.0
|
||||||
|
with:
|
||||||
|
host: https://sonarqube.grimsi.de
|
||||||
|
login: ${{ secrets.SONARQUBE_TOKEN }}
|
||||||
|
projectKey: grimsi_gameyfin_AYPM67pzsxiaNzCh9BZd
|
||||||
|
|
||||||
|
- name: Upload build artifact
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: gameyfin-${{ steps.project.outputs.GAMEYFIN_VERSION }}.jar
|
||||||
|
path: backend/target/gameyfin-*.jar
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
name: Gameyfin Release
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
branch:
|
||||||
|
description: "The branch to checkout when cutting the release."
|
||||||
|
required: true
|
||||||
|
default: "main"
|
||||||
|
releaseVersion:
|
||||||
|
description: "Default version to use when preparing a release."
|
||||||
|
required: true
|
||||||
|
default: "X.Y.Z"
|
||||||
|
developmentVersion:
|
||||||
|
description: "Default version to use for new local working copy."
|
||||||
|
required: true
|
||||||
|
default: "X.Y.Z-SNAPSHOT"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
name: Release
|
||||||
|
steps:
|
||||||
|
- name: Git checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
ref: ${{ github.event.inputs.branch }}
|
||||||
|
|
||||||
|
- name: Set up JDK
|
||||||
|
uses: actions/setup-java@v3
|
||||||
|
with:
|
||||||
|
java-version: '18'
|
||||||
|
distribution: 'temurin'
|
||||||
|
cache: 'maven'
|
||||||
|
|
||||||
|
- name: Maven build
|
||||||
|
run: mvn --batch-mode --update-snapshots package -Dmaven.test.skip=true
|
||||||
|
|
||||||
|
- name: Configure Git User
|
||||||
|
run: |
|
||||||
|
git config user.email "actions@github.com"
|
||||||
|
git config user.name "GitHub Actions"
|
||||||
|
|
||||||
|
- name: Maven Release
|
||||||
|
run: mvn release:prepare release:perform -B -s .maven_settings.xml -DreleaseVersion=${{ github.event.inputs.releaseVersion }} -DdevelopmentVersion=${{ github.event.inputs.developmentVersion }}
|
||||||
|
env:
|
||||||
|
GITHUB_ACTOR: ${{ github.actor }}
|
||||||
|
GITHUB_TOKEN: ${{ github.token }}
|
||||||
|
|
||||||
|
- name: Git tag
|
||||||
|
uses: mathieudutour/github-tag-action@v6.0
|
||||||
|
with:
|
||||||
|
github_token: ${{ github.token }}
|
||||||
|
default_bump: false
|
||||||
|
custom_tag: ${{ github.event.inputs.releaseVersion }}
|
||||||
|
|
||||||
|
- name: Github Release
|
||||||
|
uses: "marvinpinto/action-automatic-releases@v1.2.1"
|
||||||
|
with:
|
||||||
|
repo_token: ${{ github.token }}
|
||||||
|
prerelease: false
|
||||||
|
files: |
|
||||||
|
LICENSE.md
|
||||||
|
backend/target/gameyfin-*.jar
|
||||||
|
config/gameyfin.properties
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<settings xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
|
||||||
|
<servers>
|
||||||
|
<server>
|
||||||
|
<id>github</id>
|
||||||
|
<username>${env.GITHUB_ACTOR}</username>
|
||||||
|
<password>${env.GITHUB_TOKEN}</password>
|
||||||
|
</server>
|
||||||
|
</servers>
|
||||||
|
</settings>
|
||||||
+2
-2
@@ -7,7 +7,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>gameyfin</artifactId>
|
<artifactId>gameyfin</artifactId>
|
||||||
<groupId>de.grimsi</groupId>
|
<groupId>de.grimsi</groupId>
|
||||||
<version>1.2.1</version>
|
<version>1.2.2-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>gameyfin-backend</artifactId>
|
<artifactId>gameyfin-backend</artifactId>
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
<properties>
|
<properties>
|
||||||
<java.version>18</java.version>
|
<java.version>18</java.version>
|
||||||
|
|
||||||
<springdoc-openapi-ui.version>1.6.9</springdoc-openapi-ui.version>
|
<springdoc-openapi-ui.version>1.6.11</springdoc-openapi-ui.version>
|
||||||
<resilience4j.version>1.7.1</resilience4j.version>
|
<resilience4j.version>1.7.1</resilience4j.version>
|
||||||
<commons-io.version>2.11.0</commons-io.version>
|
<commons-io.version>2.11.0</commons-io.version>
|
||||||
<commons-compress.version>1.21</commons-compress.version>
|
<commons-compress.version>1.21</commons-compress.version>
|
||||||
|
|||||||
@@ -2,16 +2,25 @@ package de.grimsi.gameyfin.config;
|
|||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.boot.context.event.ApplicationReadyEvent;
|
||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
import org.springframework.boot.jdbc.DataSourceBuilder;
|
import org.springframework.boot.jdbc.DataSourceBuilder;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.context.annotation.Primary;
|
import org.springframework.context.annotation.Primary;
|
||||||
|
import org.springframework.context.event.EventListener;
|
||||||
import org.springframework.core.env.*;
|
import org.springframework.core.env.*;
|
||||||
import org.springframework.util.PropertyPlaceholderHelper;
|
import org.springframework.util.PropertyPlaceholderHelper;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
import javax.sql.DataSource;
|
import javax.sql.DataSource;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.LinkOption;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.nio.file.Paths;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.stream.StreamSupport;
|
import java.util.stream.StreamSupport;
|
||||||
@@ -19,6 +28,8 @@ import java.util.stream.StreamSupport;
|
|||||||
@Configuration
|
@Configuration
|
||||||
public class FilesystemConfig {
|
public class FilesystemConfig {
|
||||||
|
|
||||||
|
private static final String INTERNAL_FOLDER_NAME = ".gameyfin";
|
||||||
|
|
||||||
@Value("#{'${gameyfin.sources}'.split(',')[0]}")
|
@Value("#{'${gameyfin.sources}'.split(',')[0]}")
|
||||||
private String firstLibraryPath;
|
private String firstLibraryPath;
|
||||||
|
|
||||||
@@ -31,16 +42,29 @@ public class FilesystemConfig {
|
|||||||
@Autowired
|
@Autowired
|
||||||
Environment env;
|
Environment env;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This will make sure that the internal folder (".gameyfin") is marked as hidden on DOS/Windows-based systems.
|
||||||
|
* On UNIX-based systems files and folders starting with a dot are hidden
|
||||||
|
*/
|
||||||
|
@EventListener(ApplicationReadyEvent.class)
|
||||||
|
public void hideInternalFolderOnDOS() throws IOException {
|
||||||
|
Path internalFolder = Paths.get("%s/%s".formatted(firstLibraryPath, INTERNAL_FOLDER_NAME));
|
||||||
|
|
||||||
|
if(!Files.exists(internalFolder) || !Files.isDirectory(internalFolder)) return;
|
||||||
|
|
||||||
|
Files.setAttribute(internalFolder, "dos:hidden", Boolean.TRUE, LinkOption.NOFOLLOW_LINKS);
|
||||||
|
}
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public void setConfigurableEnvironment(ConfigurableEnvironment env) {
|
public void setConfigurableEnvironment(ConfigurableEnvironment env) {
|
||||||
Properties props = new Properties();
|
Properties props = new Properties();
|
||||||
|
|
||||||
if(!StringUtils.hasText(dbPath)) {
|
if(!StringUtils.hasText(dbPath)) {
|
||||||
props.setProperty("gameyfin.db", "%s/.gameyfin/db".formatted(firstLibraryPath));
|
props.setProperty("gameyfin.db", "%s/%s/db".formatted(firstLibraryPath, INTERNAL_FOLDER_NAME));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!StringUtils.hasText(cachePath)) {
|
if(!StringUtils.hasText(cachePath)) {
|
||||||
props.setProperty("gameyfin.cache", "%s/.gameyfin/cache".formatted(firstLibraryPath));
|
props.setProperty("gameyfin.cache", "%s/%s/cache".formatted(firstLibraryPath, INTERNAL_FOLDER_NAME));
|
||||||
}
|
}
|
||||||
|
|
||||||
env.getPropertySources().addFirst(new PropertiesPropertySource("gameyfinFilesystemProperties", props));
|
env.getPropertySources().addFirst(new PropertiesPropertySource("gameyfinFilesystemProperties", props));
|
||||||
|
|||||||
@@ -16,8 +16,10 @@ import org.springframework.stereotype.Service;
|
|||||||
import org.springframework.util.StopWatch;
|
import org.springframework.util.StopWatch;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.nio.file.DirectoryStream;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
|
import java.nio.file.Paths;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@@ -46,7 +48,28 @@ public class LibraryService {
|
|||||||
folder -> {
|
folder -> {
|
||||||
try (Stream<Path> stream = Files.list(folder)) {
|
try (Stream<Path> stream = Files.list(folder)) {
|
||||||
// return all sub-folders (non-recursive) and files that have an extension that indicates that they are a downloadable file
|
// return all sub-folders (non-recursive) and files that have an extension that indicates that they are a downloadable file
|
||||||
List<Path> gameFilesFromThisFolder = stream.filter(p -> Files.isDirectory(p) || hasGameArchiveExtension(p)).toList();
|
List<Path> gameFilesFromThisFolder = stream
|
||||||
|
.filter(p -> Files.isDirectory(p) || hasGameArchiveExtension(p))
|
||||||
|
// filter out all hidden files and folders
|
||||||
|
.filter(p -> {
|
||||||
|
try {
|
||||||
|
return !(Files.isHidden(p));
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException("Error while checking if '%s' is hidden.".formatted(p), e);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
// filter out all empty directories
|
||||||
|
.filter(p -> {
|
||||||
|
if(!Files.isDirectory(p)) return true;
|
||||||
|
|
||||||
|
try(DirectoryStream<Path> s = Files.newDirectoryStream(p)) {
|
||||||
|
return s.iterator().hasNext();
|
||||||
|
} catch(IOException e) {
|
||||||
|
throw new RuntimeException("Error while checking if folder '%s' is empty.".formatted(p), e);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.toList();
|
||||||
|
|
||||||
gamefiles.addAll(gameFilesFromThisFolder);
|
gamefiles.addAll(gameFilesFromThisFolder);
|
||||||
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
# Uncomment if you want to change the port from 8080
|
||||||
|
# server.port=8081
|
||||||
|
|
||||||
|
# Gameyfin admin interface username and password
|
||||||
|
gameyfin.user=<your username here>
|
||||||
|
gameyfin.password=<your password here>
|
||||||
|
|
||||||
|
# Gameyfin source folders
|
||||||
|
gameyfin.sources=<comma-seperated list of root folders of your game libraries>
|
||||||
|
|
||||||
|
# Uncomment if you want to specify the Gameyfin database path (default is <game library root>/.gameyfin/db)
|
||||||
|
# gameyfin.db=<custom path to db file>
|
||||||
|
|
||||||
|
# Uncomment if you want to specify the Gameyfin cache path (default is <game library root>/.gameyfin/cache)
|
||||||
|
# gameyfin.cache=<custom path to cache folder>
|
||||||
|
|
||||||
|
# Your twitch client-id and client-secret
|
||||||
|
gameyfin.igdb.api.client-id=<your twitch client-id here>
|
||||||
|
gameyfin.igdb.api.client-secret=<your twitch client-secret here>
|
||||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "frontend",
|
"name": "frontend",
|
||||||
"version": "1.2.1",
|
"version": "1.2.2-SNAPSHOT",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "frontend",
|
"name": "frontend",
|
||||||
"version": "1.2.1",
|
"version": "1.2.2-SNAPSHOT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@angular/animations": "^14.0.0",
|
"@angular/animations": "^14.0.0",
|
||||||
"@angular/cdk": "^14.1.0",
|
"@angular/cdk": "^14.1.0",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "frontend",
|
"name": "frontend",
|
||||||
"version": "1.2.1",
|
"version": "1.2.2-SNAPSHOT",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"ng": "ng",
|
"ng": "ng",
|
||||||
"start": "ng serve",
|
"start": "ng serve",
|
||||||
|
|||||||
+1
-1
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>gameyfin</artifactId>
|
<artifactId>gameyfin</artifactId>
|
||||||
<groupId>de.grimsi</groupId>
|
<groupId>de.grimsi</groupId>
|
||||||
<version>1.2.1</version>
|
<version>1.2.2-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -1,25 +1,45 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
<groupId>de.grimsi</groupId>
|
<groupId>de.grimsi</groupId>
|
||||||
<artifactId>gameyfin</artifactId>
|
<artifactId>gameyfin</artifactId>
|
||||||
<version>1.2.1</version>
|
<version>1.2.2-SNAPSHOT</version>
|
||||||
<name>gameyfin</name>
|
<name>gameyfin</name>
|
||||||
<description>gameyfin</description>
|
<description>gameyfin</description>
|
||||||
|
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
<modules>
|
<modules>
|
||||||
<module>frontend</module>
|
<module>frontend</module>
|
||||||
<module>backend</module>
|
<module>backend</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-parent</artifactId>
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
<version>2.7.1</version>
|
<version>2.7.1</version>
|
||||||
<relativePath/> <!-- lookup parent from repository -->
|
<relativePath/> <!-- lookup parent from repository -->
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
<scm>
|
||||||
|
<connection>scm:git:https://github.com/grimsi/gameyfin.git</connection>
|
||||||
|
<url>scm:git:https://github.com/grimsi/gameyfin.git</url>
|
||||||
|
<developerConnection>scm:git:https://github.com/grimsi/gameyfin.git</developerConnection>
|
||||||
|
<tag>HEAD</tag>
|
||||||
|
</scm>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-release-plugin</artifactId>
|
||||||
|
<version>2.5.3</version>
|
||||||
|
<configuration>
|
||||||
|
<scmCommentPrefix>[ci skip]</scmCommentPrefix>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
sonar.projectKey=grimsi_gameyfin_AYPM67pzsxiaNzCh9BZd
|
||||||
|
|
||||||
|
# Point SONAR to the compiled Java classes
|
||||||
|
sonar.java.binaries=./backend/target
|
||||||
Reference in New Issue
Block a user