44 workflow_call :
55
66jobs :
7- windows :
8- name : Build Windows Artifact
7+ build :
8+ name : Build Windows
99 runs-on : windows-latest
10-
1110 steps :
1211 - name : Check out code
1312 uses : actions/checkout@v4
1413
15- - name : Set up Node.js
14+ - name : Set up node
1615 uses : actions/setup-node@v4
1716 with :
18- node-version : " 18 "
17+ node-version : lts/*
1918
2019 - name : Set up Rust
2120 uses : actions-rs/toolchain@v1
@@ -24,76 +23,83 @@ jobs:
2423 toolchain : stable
2524 override : true
2625
27- - name : Compute Cargo cache key
26+ # Ignore lines containing 'version = "x.x.x"' and hash the rest of Cargo.lock
27+ - name : Generate custom cache key
2828 id : cargo-hash
2929 run : |
30- grep -v '^version = ' src-tauri/Cargo.toml \
31- | shasum -a 256 \
32- | awk '{ print $1 }' > cargo_hash.txt
33- echo "CARGO_CACHE_KEY=$(<cargo_hash.txt)" >> $GITHUB_ENV
30+ grep -v '^version = ' src-tauri/Cargo.toml | shasum -a 256 | awk '{ print $1 }' > cargo_hash.txt
31+ echo "CARGO_CACHE_KEY=$(cat cargo_hash.txt)" >> $GITHUB_ENV
32+ echo "::set-output name=CARGO_CACHE_KEY::$(cat cargo_hash.txt)"
3433
3534 - name : Cache Cargo registry
3635 uses : actions/cache@v4
3736 with :
3837 path : ~/.cargo/registry
39- key : ${{ runner.os }}-cargo-registry-${{ env.CARGO_CACHE_KEY }}
40- restore-keys : ${{ runner.os }}-cargo-registry-
38+ key : ${{ runner.os }}-cargo-registry-${{ steps.cargo-hash.outputs.CARGO_CACHE_KEY }}
39+ restore-keys : |
40+ ${{ runner.os }}-cargo-registry-
4141
4242 - name : Cache Cargo git index
4343 uses : actions/cache@v4
4444 with :
4545 path : ~/.cargo/git
46- key : ${{ runner.os }}-cargo-git-${{ env.CARGO_CACHE_KEY }}
47- restore-keys : ${{ runner.os }}-cargo-git-
46+ key : ${{ runner.os }}-cargo-git-${{ steps.cargo-hash.outputs.CARGO_CACHE_KEY }}
47+ restore-keys : |
48+ ${{ runner.os }}-cargo-git-
4849
49- - name : Cache Cargo target dir
50+ - name : Cache Cargo target directory
5051 uses : actions/cache@v4
5152 with :
5253 path : src-tauri/target
53- key : ${{ runner.os }}-cargo-target-${{ env.CARGO_CACHE_KEY }}-$(rustc --version)
54- restore-keys : ${{ runner.os }}-cargo-target-
54+ key : ${{ runner.os }}-cargo-target-${{ matrix.target }}-${{ steps.cargo-hash.outputs.CARGO_CACHE_KEY }}-$(rustc --version)
55+ restore-keys : |
56+ ${{ runner.os }}-cargo-target-
5557
56- - name : Cache Tauri CLI
58+ - name : Cache Tauri CLI (cross-platform)
5759 id : tauri-cli-cache
5860 uses : actions/cache@v4
5961 with :
60- path : ~/.cargo/bin/cargo-tauri*
61- key : ${{ runner.os }}-tauri-cli-${{ env.CARGO_CACHE_KEY }}
62- restore-keys : ${{ runner.os }}-tauri-cli-
63-
64- - name : Cache node_modules
62+ path : |
63+ ~/.cargo/bin/cargo-tauri
64+ ~/.cargo/bin/cargo-tauri.exe
65+ key : ${{ runner.os }}-tauri-cli-${{ steps.cargo-hash.outputs.CARGO_CACHE_KEY }}
66+ restore-keys : |
67+ ${{ runner.os }}-tauri-cli-
68+
69+ - name : Cache pnpm store and modules
6570 uses : actions/cache@v4
6671 with :
67- path : node_modules
68- key : ${{ runner.os }}-node-modules-${{ hashFiles('package-lock.json') }}
69- restore-keys : ${{ runner.os }}-node-modules-
70-
71- - name : Install dependencies
72+ path : |
73+ ~/.pnpm-store
74+ node_modules
75+ key : ${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
76+ restore-keys : |
77+ ${{ runner.os }}-pnpm-
78+
79+ - name : Install Node Module
7280 run : |
7381 npm i pnpm -g
82+ echo "C:/Users/runneradmin/AppData/Roaming/npm" >> $GITHUB_PATH
7483 pnpm i
75- shell : bash
7684
7785 - name : Install Protoc
7886 uses : arduino/setup-protoc@v3
7987 with :
8088 version : " 22.2"
8189
82- - name : Install Tauri CLI if needed
83- run : cargo install tauri-cli --version ^1 .0.0
90+ - name : Install Tauri CLI if not cached
91+ run : cargo install tauri-cli --version ^2 .0.0
8492 if : steps.tauri-cli-cache.outputs.cache-hit != 'true'
8593
86- - name : Build Tauri bundle
94+ - name : Build
8795 run : cargo tauri build
8896 working-directory : ./src-tauri
8997
90- - name : Create output dir
91- run : mkdir -p output
92- shell : bash
98+ - name : Create output directory
99+ run : mkdir output
93100
94- - name : Copy executables
101+ - name : Copy files to output
95102 run : cp src-tauri/target/release/bundle/nsis/*.exe output/
96- shell : bash
97103
98104 - name : Upload artifact
99105 uses : actions/upload-artifact@v4
0 commit comments