Skip to content

Commit 3d1e182

Browse files
Dev: add ms build
1 parent f7cd84a commit 3d1e182

2 files changed

Lines changed: 115 additions & 69 deletions

File tree

.github/workflows/msix.yml

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
name: Build Microsoft Store MSIX
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
ref:
7+
description: 'Branch, tag, or commit SHA to build'
8+
required: true
9+
default: main
10+
type: string
11+
architectures:
12+
description: 'Architectures to include'
13+
required: true
14+
default: x64,arm64
15+
type: string
16+
17+
permissions:
18+
contents: read
19+
20+
concurrency:
21+
group: msix-${{ github.event.inputs.ref }}
22+
cancel-in-progress: false
23+
24+
jobs:
25+
build:
26+
name: Build MSIX bundle
27+
runs-on: windows-latest
28+
env:
29+
RUSTC_WRAPPER: sccache
30+
SCCACHE_GHA_ENABLED: "true"
31+
32+
steps:
33+
- uses: actions/checkout@v5
34+
with:
35+
ref: ${{ github.event.inputs.ref }}
36+
37+
- name: Setup Volta
38+
uses: volta-cli/action@v4
39+
40+
- name: Rust toolchain
41+
uses: dtolnay/rust-toolchain@stable
42+
43+
- name: Install Windows Rust targets
44+
run: rustup target add x86_64-pc-windows-msvc aarch64-pc-windows-msvc
45+
46+
- name: Setup sccache
47+
uses: mozilla-actions/sccache-action@v0.0.9
48+
49+
- name: Rust cache
50+
uses: Swatinem/rust-cache@v2
51+
with:
52+
prefix-key: v1-rust
53+
shared-key: msix-windows
54+
workspaces: src-tauri
55+
cache-on-failure: true
56+
57+
- name: Resolve npm cache directory
58+
id: npm-cache-dir
59+
shell: bash
60+
run: echo "dir=$(npm config get cache)" >> "$GITHUB_OUTPUT"
61+
62+
- name: Cache npm
63+
uses: actions/cache@v4
64+
with:
65+
path: ${{ steps.npm-cache-dir.outputs.dir }}
66+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
67+
restore-keys: |
68+
${{ runner.os }}-node-
69+
70+
- name: Install npm dependencies
71+
run: npm ci
72+
73+
- name: Install MSIX bundle tool
74+
run: cargo install msixbundle-cli
75+
76+
- name: Configure Microsoft Store package
77+
shell: pwsh
78+
env:
79+
MSIX_PUBLISHER: ${{ secrets.MSIX_PUBLISHER }}
80+
MSIX_PUBLISHER_DISPLAY_NAME: ${{ secrets.MSIX_PUBLISHER_DISPLAY_NAME }}
81+
MSIX_PFX_BASE64: ${{ secrets.MSIX_PFX_BASE64 }}
82+
run: |
83+
if (-not $env:MSIX_PUBLISHER) {
84+
throw "MSIX_PUBLISHER secret is required to build a Microsoft Store package in CI."
85+
}
86+
87+
$configPath = "src-tauri/gen/windows/bundle.config.json"
88+
$config = Get-Content $configPath -Raw | ConvertFrom-Json
89+
$config.publisher = $env:MSIX_PUBLISHER
90+
91+
if ($env:MSIX_PUBLISHER_DISPLAY_NAME) {
92+
$config.publisherDisplayName = $env:MSIX_PUBLISHER_DISPLAY_NAME
93+
}
94+
95+
if ($env:MSIX_PFX_BASE64) {
96+
$pfxPath = Join-Path $env:RUNNER_TEMP "msix-signing.pfx"
97+
[IO.File]::WriteAllBytes($pfxPath, [Convert]::FromBase64String($env:MSIX_PFX_BASE64))
98+
$config.signing.pfx = $pfxPath
99+
$config.signing.pfxPassword = $null
100+
}
101+
102+
$config | ConvertTo-Json -Depth 20 | Set-Content $configPath
103+
104+
- name: Build Microsoft Store MSIX bundle
105+
shell: bash
106+
env:
107+
MSIX_PFX_PASSWORD: ${{ secrets.MSIX_PFX_PASSWORD }}
108+
run: npm run tauri:windows:build -- --arch "${{ github.event.inputs.architectures }}" --runner npm --verbose
109+
110+
- name: Upload MSIX artifact
111+
uses: actions/upload-artifact@v4
112+
with:
113+
name: sigma-file-manager-windows-store-msix
114+
path: src-tauri/target/msix/*.msixbundle
115+
if-no-files-found: error

.github/workflows/release.yml

Lines changed: 0 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -155,10 +155,6 @@ jobs:
155155
- name: Rust toolchain
156156
uses: dtolnay/rust-toolchain@stable
157157

158-
- name: Install Windows Rust targets
159-
if: matrix.platform == 'windows'
160-
run: rustup target add x86_64-pc-windows-msvc aarch64-pc-windows-msvc
161-
162158
- name: Setup sccache
163159
uses: mozilla-actions/sccache-action@v0.0.9
164160

@@ -257,71 +253,6 @@ jobs:
257253
gh release upload "$TAG" "$staged_asset" --clobber
258254
done
259255
260-
- name: Install MSIX bundle tool
261-
if: matrix.platform == 'windows'
262-
run: cargo install msixbundle-cli
263-
264-
- name: Configure Microsoft Store package
265-
if: matrix.platform == 'windows'
266-
shell: pwsh
267-
env:
268-
MSIX_PUBLISHER: ${{ secrets.MSIX_PUBLISHER }}
269-
MSIX_PUBLISHER_DISPLAY_NAME: ${{ secrets.MSIX_PUBLISHER_DISPLAY_NAME }}
270-
MSIX_PFX_BASE64: ${{ secrets.MSIX_PFX_BASE64 }}
271-
run: |
272-
if (-not $env:MSIX_PUBLISHER) {
273-
throw "MSIX_PUBLISHER secret is required to build a Microsoft Store package in CI."
274-
}
275-
276-
$configPath = "src-tauri/gen/windows/bundle.config.json"
277-
$config = Get-Content $configPath -Raw | ConvertFrom-Json
278-
279-
if ($env:MSIX_PUBLISHER) {
280-
$config.publisher = $env:MSIX_PUBLISHER
281-
}
282-
283-
if ($env:MSIX_PUBLISHER_DISPLAY_NAME) {
284-
$config.publisherDisplayName = $env:MSIX_PUBLISHER_DISPLAY_NAME
285-
}
286-
287-
if ($env:MSIX_PFX_BASE64) {
288-
$pfxPath = Join-Path $env:RUNNER_TEMP "msix-signing.pfx"
289-
[IO.File]::WriteAllBytes($pfxPath, [Convert]::FromBase64String($env:MSIX_PFX_BASE64))
290-
$config.signing.pfx = $pfxPath
291-
$config.signing.pfxPassword = $null
292-
}
293-
294-
$config | ConvertTo-Json -Depth 20 | Set-Content $configPath
295-
296-
- name: Build Microsoft Store MSIX bundle
297-
if: matrix.platform == 'windows'
298-
env:
299-
MSIX_PFX_PASSWORD: ${{ secrets.MSIX_PFX_PASSWORD }}
300-
run: npm run tauri:windows:build -- --arch x64,arm64 --runner npm --verbose
301-
302-
- name: Upload Microsoft Store MSIX bundle
303-
if: matrix.platform == 'windows'
304-
env:
305-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
306-
TAG: ${{ needs.prepare.outputs.tag }}
307-
VERSION: ${{ needs.prepare.outputs.version }}
308-
shell: bash
309-
run: |
310-
mkdir -p staged
311-
shopt -s nullglob
312-
313-
bundles=(src-tauri/target/msix/*.msixbundle)
314-
if (( ${#bundles[@]} == 0 )); then
315-
echo "::error::No Microsoft Store MSIX bundle found"
316-
exit 1
317-
fi
318-
319-
for bundle in "${bundles[@]}"; do
320-
staged_asset="staged/Sigma-File-Manager-${VERSION}-windows-store.msixbundle"
321-
cp "$bundle" "$staged_asset"
322-
gh release upload "$TAG" "$staged_asset" --clobber
323-
done
324-
325256
- name: Upload Linux binary
326257
if: matrix.platform == 'linux'
327258
env:

0 commit comments

Comments
 (0)