Skip to content

Commit b8c2963

Browse files
Refactor CD workflow for multi-platform support
Modified .github/workflows/cd.yml to enable building and packaging on macOS, Linux, and Windows. Key changes: - Updated the build job to run on a matrix of `ubuntu-latest`, `macos-latest`, and `windows-latest`. - Adapted the `jpackage` command for cross-platform compatibility by removing the Windows-specific `--win-console` option. The `--type app-image` is used to generate platform-specific application bundles. - Modified the artifact upload step to name artifacts with the pattern `https-proxy-${{ matrix.os }}-${{ inputs.version }}` for clarity and platform distinction. This change allows the project to distribute platform-specific executables for a wider range of users. Manual testing of the workflow is recommended to ensure correct operation on all platforms.
1 parent 141d121 commit b8c2963

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

.github/workflows/cd.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ on:
1010
default: '0.1.0'
1111
jobs:
1212
build_and_push:
13-
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
os: [ubuntu-latest, macos-latest, windows-latest]
16+
runs-on: ${{ matrix.os }}
1417
permissions:
1518
contents: read
1619

@@ -27,12 +30,12 @@ jobs:
2730
run: sbt clean stage
2831

2932
- name: package
30-
run: jpackage --name https-proxy --input target/universal/stage/lib --main-jar https-proxy.https-proxy-${{ inputs.version }}.jar --main-class Main --type app-image --win-console
33+
run: jpackage --name https-proxy --input target/universal/stage/lib --main-jar https-proxy.https-proxy-${{ inputs.version }}.jar --main-class Main --type app-image
3134
- name: release
3235
# 上传 https-proxy 目录
3336
uses: actions/upload-artifact@v4
3437
with:
35-
name: https-proxy-${{ inputs.version }}
38+
name: https-proxy-${{ matrix.os }}-${{ inputs.version }}
3639
path: https-proxy
3740

3841

0 commit comments

Comments
 (0)