diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index cbe1112..c66a046 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,22 +1,39 @@ name: Releases # 触发条件:git tag -on: - push: - tags: - - 'v*' +#on: +# push: +# tags: +# - 'v*' +on: push jobs: release: # 运行环境 runs-on: ubuntu-latest + permissions: + contents: write steps: # 拉取项目代码 - name: Checkout code - uses: actions/checkout@v3 - # Release + uses: actions/checkout@v4 + - name: Set up JDK and Maven + uses: actions/setup-java@v4 + with: + distribution: 'corretto' + java-version: '17' + # - name: Set up mvnd + # run: | + # curl -s "https://get.sdkman.io" | bash + # source "$HOME/.sdkman/bin/sdkman-init.sh" + # sdk version + # sdk install mvnd + # mvnd -v + - name: Build executable + run: sh deploy-linux.sh - name: Create Release - uses: ncipollo/release-action@v1.11.2 + uses: ncipollo/release-action@v1 with: - bodyFile: "README.md" + # 供用户下载使用的最终产物 + artifacts: "dist/So Novel-1.5.1.exe" token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitignore b/.gitignore index 45510af..82c46a6 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,4 @@ buildNumber.properties *.iml .idea download/ +dist/ diff --git a/deploy-linux.sh b/deploy-linux.sh new file mode 100644 index 0000000..0aed992 --- /dev/null +++ b/deploy-linux.sh @@ -0,0 +1,23 @@ +mvn clean package "-DskipTests" + +cd target +mkdir tmp +mv app-jar-with-dependencies.jar tmp +mv classes tmp +pwd +ls +cd .. +pwd +ls + +jpackage \ +--name "So Novel" \ +--input "target/tmp" \ +--dest dist \ +--icon assets/logo.ico \ +--app-version 1.5.1 \ +--copyright "Copyright (C) 2024 pcdd. All rights reserved." \ +--description "开源搜书神器" \ +--vendor "github.com/pcdd-group" \ +--about-url "github.com/pcdd-group/so-novel" \ +--main-jar app-jar-with-dependencies.jar diff --git a/deploy-windows.sh b/deploy-windows.sh new file mode 100644 index 0000000..1fb5a89 --- /dev/null +++ b/deploy-windows.sh @@ -0,0 +1,42 @@ +mvn clean package "-DskipTests" + +cd target +mkdir tmp +mv app-jar-with-dependencies.jar tmp +mv classes tmp +pwd +ls +cd .. +pwd +ls + +# --win-console 控制台应用程序 +# --win-shortcut 桌面上创建快捷方式 +# --win-dir-chooser 用户可以选择安装目录 +# --win-menu 添加到开始菜单(搜索用) +# --vendor 应用程序的供应商(作者) +# --input 待打包文件所在输入目录的路径 +# --dest 生成的输出文件放置的路径 +# --install-dir 默认安装位置下面的相对子路径 +# --about-url 应用程序主页的 URL +# 参数有 : 是非法字符,放在尾行 + +jpackage ` +--name "So Novel" ` +--input "target/tmp" ` +--dest dist ` +--icon assets/logo.ico ` +--type exe ` +--app-version 1.5.1 ` +--copyright "Copyright (C) 2024 pcdd. All rights reserved." ` +--description "开源搜书神器" ` +--install-dir "So Novel" ` +--win-console ` +--win-dir-chooser ` +--win-shortcut ` +--win-shortcut-prompt ` +--win-menu ` +--vendor "github.com/pcdd-group" ` +--about-url "github.com/pcdd-group/so-novel" ` +--win-update-url "github.com/pcdd-group/so-novel/release" ` +--main-jar app-jar-with-dependencies.jar diff --git a/deploy.sh b/deploy.sh deleted file mode 100644 index 2f16ee5..0000000 --- a/deploy.sh +++ /dev/null @@ -1,19 +0,0 @@ -mvnd clean package "-Dmaven.test.skip=true" - -# --win-console 控制台应用程序 -# --win-shortcut 桌面上创建快捷方式 -# --win-dir-chooser 用户可以选择安装目录 -# --win-menu 添加到开始菜单(搜索用) -# vendor 发布者 - -jpackage --name "SoNovel" ` ---win-console ` ---win-dir-chooser ` ---win-shortcut ` ---win-menu ` ---input . ` ---icon assets/logo.ico ` ---app-version 1.5.0 ` ---vendor "pcdd" ` ---description "开源搜书神器" ` ---main-jar target/app-jar-with-dependencies.jar \ No newline at end of file diff --git a/pom.xml b/pom.xml index 13e5e22..24fc420 100644 --- a/pom.xml +++ b/pom.xml @@ -32,9 +32,9 @@ 1.18.30 - nl.siegmann.epublib - epublib-core - 3.1 + io.documentnode + epub4j-core + 4.2.1 org.junit.jupiter @@ -102,12 +102,4 @@ - - - - psiegman-repo - https://github.com/psiegman/mvn-repo/raw/master/releases - - - diff --git a/src/main/java/com/pcdd/sonovel/core/CrawlerPostHandler.java b/src/main/java/com/pcdd/sonovel/core/CrawlerPostHandler.java index 6d688e4..c705f6e 100644 --- a/src/main/java/com/pcdd/sonovel/core/CrawlerPostHandler.java +++ b/src/main/java/com/pcdd/sonovel/core/CrawlerPostHandler.java @@ -7,11 +7,11 @@ import cn.hutool.http.HttpUtil; import cn.hutool.setting.dialect.Props; import com.pcdd.sonovel.model.Book; +import io.documentnode.epub4j.domain.Author; +import io.documentnode.epub4j.domain.Resource; +import io.documentnode.epub4j.epub.EpubWriter; import lombok.SneakyThrows; import lombok.experimental.UtilityClass; -import nl.siegmann.epublib.domain.Author; -import nl.siegmann.epublib.domain.Resource; -import nl.siegmann.epublib.epub.EpubWriter; import java.io.File; import java.io.FileOutputStream; @@ -47,7 +47,7 @@ public void handle(String extName, Book book, File saveDir) { @SneakyThrows private void convertToEpub(File dir, Book b) { - nl.siegmann.epublib.domain.Book book = new nl.siegmann.epublib.domain.Book(); + io.documentnode.epub4j.domain.Book book = new io.documentnode.epub4j.domain.Book(); book.getMetadata().addTitle(b.getBookName()); book.getMetadata().addAuthor(new Author(b.getAuthor())); book.getMetadata().addDescription(b.getDescription()); diff --git a/src/test/java/com/pcdd/sonovel/EpubTest.java b/src/test/java/com/pcdd/sonovel/EpubTest.java index 1d06e61..ce0bf8c 100644 --- a/src/test/java/com/pcdd/sonovel/EpubTest.java +++ b/src/test/java/com/pcdd/sonovel/EpubTest.java @@ -1,11 +1,11 @@ package com.pcdd.sonovel; import cn.hutool.core.io.resource.ResourceUtil; +import io.documentnode.epub4j.domain.Author; +import io.documentnode.epub4j.domain.Book; +import io.documentnode.epub4j.domain.Resource; +import io.documentnode.epub4j.epub.EpubWriter; import lombok.SneakyThrows; -import nl.siegmann.epublib.domain.Author; -import nl.siegmann.epublib.domain.Book; -import nl.siegmann.epublib.domain.Resource; -import nl.siegmann.epublib.epub.EpubWriter; import org.junit.jupiter.api.Test; import java.io.FileOutputStream;