66 - ' v*'
77 workflow_dispatch :
88
9+ permissions :
10+ id-token : write
11+ contents : write
12+ packages : write
13+
914jobs :
15+ build-binaries :
16+ name : Build Binaries
17+ runs-on : ${{ matrix.platform }}
18+
19+ strategy :
20+ matrix :
21+ platform : [ubuntu-latest, windows-latest, macos-latest]
22+ arch :
23+ - x64
24+ - arm64
25+ exclude :
26+ - platform : windows-latest
27+ arch : arm64
28+
29+ steps :
30+ - name : Checkout
31+ uses : actions/checkout@v4
32+ with :
33+ fetch-depth : 0
34+
35+ - name : Install Tools
36+ uses : ./.github/actions/install-tools
37+
38+ - name : Set up MSVC Environment
39+ if : runner.os == 'Windows'
40+ uses : ilammy/msvc-dev-cmd@v1
41+ with :
42+ arch : ${{ matrix.arch }}
43+
44+ - name : Remove Git link.exe from PATH
45+ if : runner.os == 'Windows'
46+ run : |
47+ echo "Original PATH: %PATH%"
48+ set PATH=%PATH:"C:\Program Files\Git\usr\bin";=%
49+ echo "Modified PATH: %PATH%"
50+ shell : cmd
51+
52+ - name : Check for Correct link.exe
53+ if : runner.os == 'Windows'
54+ run : where link
55+
56+ - name : Install Cross
57+ if : runner.os != 'Windows'
58+ run : cargo install cross --locked
59+
60+ - name : Build Binaries (Unix)
61+ if : runner.os != 'Windows'
62+ run : |
63+ echo "Building for ${{ matrix.platform }} on architecture ${{ matrix.arch }}"
64+ if [[ "${{ matrix.platform }}" == "ubuntu-latest" ]]; then
65+ if [[ "${{ matrix.arch }}" == "x64" ]]; then
66+ cross build --release --target x86_64-unknown-linux-gnu
67+ elif [[ "${{ matrix.arch }}" == "arm64" ]]; then
68+ cross build --release --target aarch64-unknown-linux-gnu
69+ fi
70+ elif [[ "${{ matrix.platform }}" == "macos-latest" ]]; then
71+ if [[ "${{ matrix.arch }}" == "x64" ]]; then
72+ cross build --release --target x86_64-apple-darwin
73+ elif [[ "${{ matrix.arch }}" == "arm64" ]]; then
74+ cross build --release --target aarch64-apple-darwin
75+ fi
76+ fi
77+ shell : bash
78+
79+ - name : Build Binaries (Windows)
80+ if : runner.os == 'Windows'
81+ run : |
82+ echo "Building for ${{ matrix.platform }} on architecture ${{ matrix.arch }}"
83+ cargo build --release --target x86_64-pc-windows-msvc
84+ shell : cmd
85+
86+ - name : Move Binaries to Bin Folder (Unix)
87+ if : runner.os != 'Windows'
88+ run : |
89+ if [[ "${{ matrix.platform }}" == "ubuntu-latest" ]]; then
90+ if [[ "${{ matrix.arch }}" == "x64" ]]; then
91+ mkdir -p ./build/linux/x64
92+ cp target/x86_64-unknown-linux-gnu/release/todoctor ./build/linux/x64/todoctor
93+ elif [[ "${{ matrix.arch }}" == "arm64" ]]; then
94+ mkdir -p ./build/linux/arm64
95+ cp target/aarch64-unknown-linux-gnu/release/todoctor ./build/linux/arm64/todoctor
96+ fi
97+ elif [[ "${{ matrix.platform }}" == "macos-latest" ]]; then
98+ if [[ "${{ matrix.arch }}" == "x64" ]]; then
99+ mkdir -p ./build/macos/x64
100+ cp target/x86_64-apple-darwin/release/todoctor ./build/macos/x64/todoctor
101+ elif [[ "${{ matrix.arch }}" == "arm64" ]]; then
102+ mkdir -p ./build/macos/arm64
103+ cp target/aarch64-apple-darwin/release/todoctor ./build/macos/arm64/todoctor
104+ fi
105+ fi
106+ shell : bash
107+
108+ - name : Move Binaries to Bin Folder (Windows)
109+ if : runner.os == 'Windows'
110+ run : |
111+ mkdir build\windows\x64
112+ copy target\x86_64-pc-windows-msvc\release\todoctor.exe build\windows\x64\todoctor.exe
113+ shell : cmd
114+
115+ - name : Upload Binaries
116+ uses : actions/upload-artifact@v4
117+ with :
118+ name : todoctor-${{ matrix.platform }}-${{ matrix.arch }}
119+ path : |
120+ ./build/windows/x64/
121+ ./build/linux/x64/
122+ ./build/linux/arm64/
123+ ./build/macos/x64/
124+ ./build/macos/arm64/
125+
10126 release :
11127 name : Release
12128 runs-on : ubuntu-latest
129+ needs : build-binaries
13130
14131 steps :
15132 - name : Checkout
@@ -23,8 +140,38 @@ jobs:
23140 - name : Install Dependencies
24141 uses : ./.github/actions/install-dependencies
25142
26- - name : Build Package
27- run : pnpm run build
143+ - name : Build Static Assets
144+ run : pnpm run build:preview
145+
146+ - name : Download Binaries for Linux x64
147+ uses : actions/download-artifact@v4
148+ with :
149+ name : todoctor-ubuntu-latest-x64
150+ path : ./build/linux/x64/
151+
152+ - name : Download Binaries for Linux arm64
153+ uses : actions/download-artifact@v4
154+ with :
155+ name : todoctor-ubuntu-latest-arm64
156+ path : ./build/linux/arm64/
157+
158+ - name : Download Binaries for macOS x64
159+ uses : actions/download-artifact@v4
160+ with :
161+ name : todoctor-macos-latest-x64
162+ path : ./build/macos/x64/
163+
164+ - name : Download Binaries for macOS arm64
165+ uses : actions/download-artifact@v4
166+ with :
167+ name : todoctor-macos-latest-arm64
168+ path : ./build/macos/arm64/
169+
170+ - name : Download Binaries for Windows x64
171+ uses : actions/download-artifact@v4
172+ with :
173+ name : todoctor-windows-latest-x64
174+ path : ./build/windows/x64/
28175
29176 - name : Create GitHub Release
30177 run : pnpm run ci:changelog
38185 run : pnpm run ci:clear
39186
40187 - name : Publish to NPM
41- run : pnpm run ci: publish
188+ run : pnpm publish --access public --no-git-checks --provenance
0 commit comments