Skip to content

Commit 6702809

Browse files
committed
.zip
1 parent 2ea63e5 commit 6702809

4 files changed

Lines changed: 57 additions & 78 deletions

File tree

.github/workflows/release-artifacts.yml

Lines changed: 6 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ permissions:
1212
contents: write
1313

1414
jobs:
15-
build-windows-exe:
15+
build-windows-zip:
1616
runs-on: windows-latest
1717
steps:
1818
- name: Checkout
@@ -31,39 +31,10 @@ jobs:
3131
distribution: temurin
3232
java-version: "17"
3333

34-
- name: Install WiX Toolset
35-
shell: powershell
36-
run: choco install wixtoolset --no-progress -y
37-
38-
- name: Add WiX to PATH
39-
shell: powershell
40-
run: |
41-
$candle = Get-Command candle.exe -ErrorAction SilentlyContinue
42-
if ($candle) {
43-
$wixBin = Split-Path $candle.Source
44-
} else {
45-
$candidates = @(
46-
"$env:ProgramFiles(x86)\WiX Toolset v3.14\bin",
47-
"$env:ProgramFiles(x86)\WiX Toolset v3.11\bin",
48-
"$env:ProgramFiles(x86)\WiX Toolset v3.10\bin",
49-
"$env:ProgramFiles\WiX Toolset v3.14\bin"
50-
)
51-
$wixBin = $candidates | Where-Object { Test-Path (Join-Path $_ 'candle.exe') } | Select-Object -First 1
52-
}
53-
54-
if (-not $wixBin) {
55-
throw "WiX Toolset was installed but candle.exe was not found."
56-
}
57-
58-
$wixBin | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
59-
Write-Host "WiX bin path added: $wixBin"
60-
6134
- name: Verify packaging tools
6235
shell: powershell
6336
run: |
6437
where.exe jpackage
65-
where.exe candle.exe
66-
where.exe light.exe
6738
6839
- name: Build shaded jar
6940
shell: cmd
@@ -100,50 +71,14 @@ jobs:
10071
-DestinationPath dist/MyNoSQL-${{ steps.app_version.outputs.version }}-windows-app.zip `
10172
-Force
10273
103-
- name: Create EXE with jpackage
104-
shell: powershell
105-
run: |
106-
$jar = Get-ChildItem target -Filter 'mynosql-*.jar' |
107-
Where-Object { $_.Name -notlike 'original-*' } |
108-
Select-Object -First 1
109-
110-
if (-not $jar) {
111-
throw "Could not find packaged JAR in target/."
112-
}
113-
114-
New-Item -Path dist -ItemType Directory -Force | Out-Null
115-
116-
jpackage `
117-
--type exe `
118-
--name MyNoSQL `
119-
--input target `
120-
--main-jar $jar.Name `
121-
--main-class com.mynosql.Main `
122-
--dest dist `
123-
--win-console
124-
125-
$exe = Get-ChildItem dist -Filter '*.exe' | Select-Object -First 1
126-
if (-not $exe) {
127-
throw "Could not find generated EXE in dist/."
128-
}
129-
130-
Rename-Item `
131-
-Path $exe.FullName `
132-
-NewName ("MyNoSQL-{0}-setup.exe" -f "${{ steps.app_version.outputs.version }}") `
133-
-Force
134-
135-
- name: Upload Windows artifacts
74+
- name: Upload Windows ZIP artifact
13675
uses: actions/upload-artifact@v4
13776
with:
138-
name: mynosql-windows-release
139-
path: |
140-
dist/*.exe
141-
dist/*.zip
77+
name: mynosql-windows-zip
78+
path: dist/*.zip
14279

143-
- name: Attach Windows artifacts to GitHub release
80+
- name: Attach Windows ZIP to GitHub release
14481
if: github.event_name == 'release'
14582
uses: softprops/action-gh-release@v2
14683
with:
147-
files: |
148-
dist/*.exe
149-
dist/*.zip
84+
files: dist/*.zip

README.md

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ java -cp "out;lib/gson-2.10.1.jar" com.mynosql.Main --shell
128128
> java -cp "out:lib/gson-2.10.1.jar" com.mynosql.Main
129129
> ```
130130
131-
### Share with Others (Windows ZIP or EXE)
131+
### Share with Others (Windows ZIP)
132132
133133
#### Option 1: Native Windows EXE installer
134134
@@ -138,6 +138,16 @@ If you want users to launch via an `.exe`, build with `jpackage` (included in mo
138138
scripts\build-exe.bat
139139
```
140140
141+
For a simple distributable ZIP (recommended for sharing):
142+
143+
```bat
144+
scripts\build-zip.bat
145+
```
146+
147+
Output:
148+
149+
- `dist/MyNoSQL-<version>-windows-app.zip`
150+
141151
Output:
142152

143153
- Installer and app files in `dist/`
@@ -154,28 +164,31 @@ When you make changes and want to send an updated Windows build:
154164

155165
1. Rebuild the app with either `scripts\build-exe.bat` or `scripts\build-app-image.bat`.
156166
2. Increase the project version in `pom.xml` if you want users to see a new version number.
157-
3. Share the new installer or the new zipped app folder.
167+
3. Share the new zipped app folder.
158168
4. If you are sharing the app-image folder, users should replace the whole folder, not just `MyNoSQL.exe`.
159169

160170
Recommended update flow:
161171

162172
- Small internal sharing: rebuild `dist-app/`, zip `dist-app/MyNoSQL/`, and send the zip.
163-
- Public release: create a GitHub Release so the workflow attaches the new JAR and Windows package automatically.
173+
- Public release: create a GitHub Release so the workflow attaches the new Windows ZIP automatically.
164174

165175
#### Option 2: Automatic release artifacts via GitHub Actions
166176

167177
This repository includes a workflow at `.github/workflows/release-artifacts.yml` that:
168178

169179
- Builds and uploads a Windows ZIP app bundle containing `MyNoSQL.exe`.
170-
- Builds and uploads Windows EXE installer artifacts.
171-
- Automatically attaches both of them to a GitHub Release when a release is published.
180+
- Automatically attaches it to a GitHub Release when a release is published.
172181

173182
You can also run it manually from the Actions tab using `workflow_dispatch`.
174183

175184
Recommended GitHub release assets for users:
176185

177-
- `MyNoSQL-<version>-windows-app.zip` for simple download and extract.
178-
- `MyNoSQL-<version>-setup.exe` for installer-style Windows setup.
186+
- `MyNoSQL-<version>-windows-app.zip` (recommended) for simple download and extract.
187+
188+
Recommendation:
189+
190+
- Prefer `MyNoSQL-<version>-windows-app.zip` as the default download for first-time users.
191+
- New unsigned installer EXEs may trigger stronger SmartScreen reputation warnings than ZIP-distributed app bundles.
179192

180193
---
181194

scripts/build-zip.bat

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
@echo off
2+
setlocal
3+
4+
REM Build app-image first (includes MyNoSQL.exe + runtime files)
5+
call "%~dp0build-app-image.bat"
6+
if errorlevel 1 (
7+
echo App-image build failed.
8+
exit /b 1
9+
)
10+
11+
if not exist dist mkdir dist
12+
13+
for /f "delims=" %%V in ('powershell -NoProfile -ExecutionPolicy Bypass -Command "[xml]$p = Get-Content 'pom.xml'; $p.project.version"') do set "APP_VERSION=%%V"
14+
if "%APP_VERSION%"=="" set "APP_VERSION=1.0.0"
15+
16+
set "ZIP_NAME=MyNoSQL-%APP_VERSION%-windows-app.zip"
17+
set "ZIP_PATH=dist\%ZIP_NAME%"
18+
19+
if exist "%ZIP_PATH%" del /q "%ZIP_PATH%"
20+
21+
powershell -NoProfile -ExecutionPolicy Bypass -Command "Compress-Archive -Path 'dist-app/MyNoSQL' -DestinationPath '%ZIP_PATH%' -Force"
22+
if errorlevel 1 (
23+
echo Failed to create ZIP package.
24+
exit /b 1
25+
)
26+
27+
echo.
28+
echo ZIP package created:
29+
echo %ZIP_PATH%
30+
31+
endlocal
2.75 KB
Binary file not shown.

0 commit comments

Comments
 (0)