Skip to content

Commit abd9b1f

Browse files
committed
feat: Github Action support macOS app
--story=1
1 parent 7e83d96 commit abd9b1f

File tree

2 files changed

+112
-9
lines changed

2 files changed

+112
-9
lines changed

.github/workflows/commit.yml

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Commit CI
33
on: [push]
44

55
jobs:
6-
build:
6+
build-windows-linux:
77
runs-on: windows-latest
88
steps:
99
- uses: actions/checkout@v4
@@ -13,7 +13,7 @@ jobs:
1313
with:
1414
dotnet-version: "8.0.x"
1515

16-
- name: Publish
16+
- name: Publish CLI and Windows GUI
1717
run: |
1818
dotnet publish --configuration Release -p:PublishSingleFile=true --self-contained false -r osx-x64 --output ./publish/osx-x64 ./src/ImeWlConverterCmd
1919
dotnet publish --configuration Release -p:PublishSingleFile=true --self-contained false -r osx-arm64 --output ./publish/osx-arm64 ./src/ImeWlConverterCmd
@@ -24,8 +24,40 @@ jobs:
2424
dotnet publish --configuration Release -p:PublishSingleFile=true --self-contained false -r win-x64 --output ./publish/win-x64 ./src/ImeWlConverterCmd
2525
dotnet publish --configuration Release -p:PublishSingleFile=true --self-contained false -r win-x64 --output ./publish/win-x64 "./src/IME WL Converter Win"
2626
27-
- name: Upload Artifact
27+
- name: Upload CLI Artifacts
2828
uses: actions/upload-artifact@v4
2929
with:
30-
name: imewlconverter
30+
name: imewlconverter-cli
31+
path: ./publish
32+
33+
build-macos-gui:
34+
runs-on: macos-latest
35+
steps:
36+
- uses: actions/checkout@v4
37+
38+
- name: Setup .NET
39+
uses: actions/setup-dotnet@v4
40+
with:
41+
dotnet-version: "8.0.x"
42+
43+
- name: Build macOS GUI (ARM64)
44+
run: |
45+
dotnet build ./src/ImeWlConverterMac --configuration Release --runtime osx-arm64
46+
47+
- name: Build macOS GUI (x64)
48+
run: |
49+
dotnet build ./src/ImeWlConverterMac --configuration Release --runtime osx-x64
50+
51+
- name: Publish macOS GUI (ARM64)
52+
run: |
53+
dotnet publish ./src/ImeWlConverterMac --configuration Release --self-contained true --runtime osx-arm64 --output ./publish/mac-arm64
54+
55+
- name: Publish macOS GUI (x64)
56+
run: |
57+
dotnet publish ./src/ImeWlConverterMac --configuration Release --self-contained true --runtime osx-x64 --output ./publish/mac-x64
58+
59+
- name: Upload macOS Artifacts
60+
uses: actions/upload-artifact@v4
61+
with:
62+
name: imewlconverter-macos
3163
path: ./publish

.github/workflows/release.yml

Lines changed: 76 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
- "v*"
77

88
jobs:
9-
build:
9+
build-windows-linux:
1010
runs-on: windows-latest
1111
steps:
1212
- uses: actions/checkout@v4
@@ -25,7 +25,7 @@ jobs:
2525
with:
2626
dotnet-version: "8.0.x"
2727

28-
- name: Publish
28+
- name: Publish CLI and Windows GUI
2929
run: |
3030
dotnet publish --configuration Release -p:PublishSingleFile=true --self-contained false -r osx-x64 --output ./publish/osx-x64 ./src/ImeWlConverterCmd
3131
dotnet publish --configuration Release -p:PublishSingleFile=true --self-contained false -r osx-arm64 --output ./publish/osx-arm64 ./src/ImeWlConverterCmd
@@ -45,10 +45,81 @@ jobs:
4545
zip -r imewlconverter_win-x86.zip publish/win-x86/*
4646
zip -r imewlconverter_win-x64.zip publish/win-x64/*
4747
48-
- uses: ncipollo/release-action@v1
48+
- name: Upload artifacts
49+
uses: actions/upload-artifact@v4
50+
with:
51+
name: cli-packages
52+
path: imewlconverter_*
53+
54+
- name: Save changelog
55+
run: echo "${{ steps.changelog.outputs.changes }}" > CHANGELOG.txt
56+
57+
- name: Upload changelog
58+
uses: actions/upload-artifact@v4
59+
with:
60+
name: changelog
61+
path: CHANGELOG.txt
62+
63+
build-macos-gui:
64+
runs-on: macos-latest
65+
steps:
66+
- uses: actions/checkout@v4
67+
68+
- name: Setup .NET
69+
uses: actions/setup-dotnet@v4
70+
with:
71+
dotnet-version: "8.0.x"
72+
73+
- name: Publish macOS GUI (ARM64)
74+
run: |
75+
dotnet publish ./src/ImeWlConverterMac --configuration Release --self-contained true --runtime osx-arm64 --output ./publish/mac-arm64
76+
77+
- name: Publish macOS GUI (x64)
78+
run: |
79+
dotnet publish ./src/ImeWlConverterMac --configuration Release --self-contained true --runtime osx-x64 --output ./publish/mac-x64
80+
81+
- name: Create .app bundles
82+
run: |
83+
chmod +x ./scripts/create-app-bundle.sh
84+
./scripts/create-app-bundle.sh ./publish/mac-arm64 "IME WL Converter"
85+
mv "IME WL Converter.app" "IME WL Converter-arm64.app"
86+
./scripts/create-app-bundle.sh ./publish/mac-x64 "IME WL Converter"
87+
mv "IME WL Converter.app" "IME WL Converter-x64.app"
88+
89+
- name: Archive macOS apps
90+
run: |
91+
zip -r imewlconverter_macos-arm64.zip "IME WL Converter-arm64.app"
92+
zip -r imewlconverter_macos-x64.zip "IME WL Converter-x64.app"
93+
94+
- name: Upload macOS artifacts
95+
uses: actions/upload-artifact@v4
96+
with:
97+
name: macos-packages
98+
path: imewlconverter_macos-*
99+
100+
release:
101+
needs: [build-windows-linux, build-macos-gui]
102+
runs-on: ubuntu-latest
103+
steps:
104+
- name: Download CLI artifacts
105+
uses: actions/download-artifact@v4
106+
with:
107+
name: cli-packages
108+
109+
- name: Download macOS artifacts
110+
uses: actions/download-artifact@v4
111+
with:
112+
name: macos-packages
113+
114+
- name: Download changelog
115+
uses: actions/download-artifact@v4
116+
with:
117+
name: changelog
118+
119+
- name: Create Release
120+
uses: ncipollo/release-action@v1
49121
with:
50122
artifacts: "imewlconverter_*"
51123
allowUpdates: true
52-
body: |
53-
${{ steps.changelog.outputs.changes }}
124+
bodyFile: CHANGELOG.txt
54125
token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)