Skip to content

Commit

Permalink
🧪 GitHub Actions Test
Browse files Browse the repository at this point in the history
  • Loading branch information
freeok committed Mar 20, 2024
1 parent 7b0e0c7 commit 2550f60
Show file tree
Hide file tree
Showing 8 changed files with 102 additions and 46 deletions.
33 changes: 25 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -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 }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ buildNumber.properties
*.iml
.idea
download/
dist/
23 changes: 23 additions & 0 deletions deploy-linux.sh
Original file line number Diff line number Diff line change
@@ -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
42 changes: 42 additions & 0 deletions deploy-windows.sh
Original file line number Diff line number Diff line change
@@ -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
19 changes: 0 additions & 19 deletions deploy.sh

This file was deleted.

14 changes: 3 additions & 11 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
<version>1.18.30</version>
</dependency>
<dependency>
<groupId>nl.siegmann.epublib</groupId>
<artifactId>epublib-core</artifactId>
<version>3.1</version>
<groupId>io.documentnode</groupId>
<artifactId>epub4j-core</artifactId>
<version>4.2.1</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
Expand Down Expand Up @@ -102,12 +102,4 @@
</resources>
</build>

<repositories>
<!-- epublib -->
<repository>
<id>psiegman-repo</id>
<url>https://github.com/psiegman/mvn-repo/raw/master/releases</url>
</repository>
</repositories>

</project>
8 changes: 4 additions & 4 deletions src/main/java/com/pcdd/sonovel/core/CrawlerPostHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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());
Expand Down
8 changes: 4 additions & 4 deletions src/test/java/com/pcdd/sonovel/EpubTest.java
Original file line number Diff line number Diff line change
@@ -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;
Expand Down

0 comments on commit 2550f60

Please sign in to comment.