Skip to content

Commit

Permalink
chore: Update workflow 文件
Browse files Browse the repository at this point in the history
  • Loading branch information
freeok committed Mar 30, 2024
1 parent 443351b commit c0f0cb7
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 68 deletions.
17 changes: 7 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name: Releases

# 触发条件:git tag
#on:
# push:
# tags:
# - 'v*'
on: workflow_dispatch
on:
push:
tags:
- 'v*'
#on: workflow_dispatch

jobs:
release-windows:
Expand All @@ -27,16 +27,14 @@ jobs:
uses: ncipollo/release-action@v1
with:
# 供用户下载使用的最终产物
artifacts: "dist/SoNovel-Portable.tar.gz"
artifacts: "dist/SoNovel_win.tar.gz"
token: ${{ secrets.GITHUB_TOKEN }}

# release-linux:
# # 运行环境
# runs-on: ubuntu-latest
# permissions:
# contents: write
# steps:
# # 拉取项目代码
# - name: Checkout code
# uses: actions/checkout@v4
# - name: Set up JDK and Maven
Expand All @@ -56,6 +54,5 @@ jobs:
# - name: Create Release
# uses: ncipollo/release-action@v1
# with:
# # 供用户下载使用的最终产物
# artifacts: "app-linux.tar.gz"
# artifacts: "dist/SoNovel_linux.tar.gz"
# token: ${{ secrets.GITHUB_TOKEN }}
31 changes: 17 additions & 14 deletions deploy-linux.sh
Original file line number Diff line number Diff line change
@@ -1,25 +1,28 @@
# 测试通过

rm -rf dist

mvn clean package "-DskipTests"

cd target
mkdir tmp
mv app-jar-with-dependencies.jar tmp
mv classes tmp
pwd
ls
cd ..
pwd
ls
mkdir target/jpackage
mv target/app-jar-with-dependencies.jar target/jpackage

# 在 linux 环境会转换为 .deb 文件
# type=app-image 记得去掉--about-url
jpackage \
--name "So Novel" \
--input "target/tmp" \
--name "SoNovel" \
--input "target/jpackage" \
--dest dist \
--icon assets/logo.ico \
--app-version 1.5.1 \
--app-version 1.5.3 \
--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
--main-jar "app-jar-with-dependencies.jar"

cp config.ini dist/SoNovel
rm dist/SoNovel/*.ico

tar -zcvf app.tar.gz dist
echo "开始打包压缩"
tar czvf dist/SoNovel_linux.tar.gz dist/SoNovel
54 changes: 10 additions & 44 deletions deploy-windows.sh
Original file line number Diff line number Diff line change
@@ -1,52 +1,18 @@
mvn clean package "-DskipTests"

cd target
mkdir tmp
mv app-jar-with-dependencies.jar tmp
mv classes tmp
cd ..
mkdir -p nobug/jpackage
mv nobug/app-jar-with-dependencies.jar nobug/jpackage

echo $PSVersionTable.PSVersion
jpackage --version
echo "开始构建exe"
# app-image 表示免安装版,部分参数不支持
#jpackage --name "SoNovel" --type "app-image" --win-console --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" --main-jar "app-jar-with-dependencies.jar"
jpackage --name "SoNovel" --type "app-image" --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" --main-jar "app-jar-with-dependencies.jar --win-console"
echo "开始压缩 zip"
tar czvf dist/SoNovel-Portable.tar.gz dist/SoNovel

# powershell 压缩为 zip
#Compress-Archive -Path dist\SoNovel -DestinationPath dist\SoNovel-Portable.zip
# TODO fix Error: Invalid Option: [target]
jpackage --name "SoNovel" --type "app-image" --input "nobug/jpackage" --dest dist --icon assets/logo.ico --app-version 1.5.3 --copyright "Copyright (C) 2024 pcdd. All rights reserved." --description "开源搜书神器" --vendor "github.com/pcdd-group" --main-jar "app-jar-with-dependencies.jar" --win-console

# cp: cannot create regular file 'dist/SoNovel': No such file or directory
cp config.ini dist/SoNovel
# rm: cannot remove ‘dist/Sollovel/*.ico′: Noj such file or directory
rm dist/SoNovel/*.ico

# --win-console 控制台应用程序
# --win-shortcut 桌面上创建快捷方式
# --win-dir-chooser 用户可以选择安装目录
# --win-menu 添加到开始菜单(搜索用)
# --vendor 应用程序的供应商(作者)
# --input 待打包文件所在输入目录的路径
# --dest 生成的输出文件放置的路径
# --install-dir 默认安装位置下面的相对子路径
# --about-url 应用程序主页的 URL
# 参数有 : 是非法字符,放在尾行

# msi 表示安装版
#jpackage `
#--type "msi" `
#--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 "开源搜书神器" `
#--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
echo "开始打包压缩"
tar czvf dist/SoNovel_win.tar.gz dist/SoNovel

0 comments on commit c0f0cb7

Please sign in to comment.