Поддержка android платформы для обновления
Some checks failed
Build rosetta-sdu / build (push) Failing after 8s
Some checks failed
Build rosetta-sdu / build (push) Failing after 8s
This commit is contained in:
61
.gitea/workflows/build.yaml
Normal file
61
.gitea/workflows/build.yaml
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
name: Build rosetta-sdu
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: java-builders
|
||||||
|
steps:
|
||||||
|
- name: Install Node.js
|
||||||
|
run: |
|
||||||
|
if command -v apt-get &> /dev/null; then
|
||||||
|
sudo apt-get update && sudo apt-get install -y nodejs npm
|
||||||
|
elif command -v brew &> /dev/null; then
|
||||||
|
brew install node
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
|
- name: Set up JDK 21
|
||||||
|
uses: actions/setup-java@v4
|
||||||
|
with:
|
||||||
|
java-version: '21'
|
||||||
|
distribution: 'temurin'
|
||||||
|
cache: maven
|
||||||
|
|
||||||
|
- name: Build with Maven
|
||||||
|
run: mvn clean package
|
||||||
|
|
||||||
|
- name: List build directory
|
||||||
|
run: ls -la build/
|
||||||
|
|
||||||
|
- name: Deploy to server via SSH
|
||||||
|
uses: appleboy/scp-action@v1
|
||||||
|
with:
|
||||||
|
host: ${{ secrets.SDU_SSH_HOST }}
|
||||||
|
username: ${{ secrets.SDU_SSH_USER }}
|
||||||
|
password: ${{ secrets.SDU_SSH_PASSWORD }}
|
||||||
|
port: ${{ secrets.SDU_SSH_PORT }}
|
||||||
|
source: "build/*"
|
||||||
|
target: ${{ secrets.SDU_DEPLOY_PATH }}
|
||||||
|
strip_components: 1
|
||||||
|
rm: false
|
||||||
|
debug: true
|
||||||
|
flatten: true
|
||||||
|
|
||||||
|
- name: Restart Docker containers
|
||||||
|
uses: appleboy/ssh-action@v1.2.5
|
||||||
|
with:
|
||||||
|
host: ${{ secrets.SDU_SSH_HOST }}
|
||||||
|
username: ${{ secrets.SDU_SSH_USER }}
|
||||||
|
password: ${{ secrets.SDU_SSH_PASSWORD }}
|
||||||
|
port: ${{ secrets.SDU_SSH_PORT }}
|
||||||
|
script: |
|
||||||
|
cd ${{ secrets.SDU_DEPLOY_PATH }}
|
||||||
|
docker-compose down
|
||||||
|
docker compose up -d --build
|
||||||
|
|
||||||
@@ -44,7 +44,7 @@ public class Main {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Значение по умолчанию.
|
// Значение по умолчанию.
|
||||||
return 8080;
|
return 7777;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void stopServer(HttpServer server) {
|
private static void stopServer(HttpServer server) {
|
||||||
|
|||||||
@@ -43,6 +43,18 @@ public class UpdatesResource {
|
|||||||
String normalizedApp = normalize(appVersion);
|
String normalizedApp = normalize(appVersion);
|
||||||
String normalizedKernel = normalize(kernelVersion);
|
String normalizedKernel = normalize(kernelVersion);
|
||||||
|
|
||||||
|
if(normalizedPlatform != null && normalizedPlatform.equals("android")) {
|
||||||
|
Optional<KernelFileInfo> latestKernel = findLatestKernel(normalizedPlatform, "universal");
|
||||||
|
if (latestKernel.isPresent()) {
|
||||||
|
KernelFileInfo info = latestKernel.get();
|
||||||
|
String lastKernelVersion = info.version();
|
||||||
|
if(compareVersions(lastKernelVersion, normalizedKernel) > 0) {
|
||||||
|
return new UpdateResponse(null, normalizedPlatform, normalizedArch, true, null,
|
||||||
|
"/kernel/" + normalizedPlatform + "/universal/" + info.fileName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Приводим платформу и архитектуру к нижнему регистру для сопоставления с
|
// Приводим платформу и архитектуру к нижнему регистру для сопоставления с
|
||||||
// именами файлов.
|
// именами файлов.
|
||||||
if (normalizedPlatform != null) {
|
if (normalizedPlatform != null) {
|
||||||
@@ -72,7 +84,7 @@ public class UpdatesResource {
|
|||||||
boolean kernelUpdateRequired = false;
|
boolean kernelUpdateRequired = false;
|
||||||
String kernelUrl = null;
|
String kernelUrl = null;
|
||||||
|
|
||||||
// Проверяем требование к ядру, только если пакет обновления найден.
|
// Проверяем требование к ядру, только если пакет обновления найден или платформа android
|
||||||
if (packSelection.updateFileName() != null
|
if (packSelection.updateFileName() != null
|
||||||
&& compareVersions(normalizedKernel, packSelection.minKernelRequired()) < 0) {
|
&& compareVersions(normalizedKernel, packSelection.minKernelRequired()) < 0) {
|
||||||
kernelUpdateRequired = true;
|
kernelUpdateRequired = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user