Skip to content

Commit f438af0

Browse files
authored
Merge pull request #95 from lich0821/fix_ci
chore(ci): fix build error
2 parents a850d3c + 65a8bd9 commit f438af0

File tree

1 file changed

+24
-22
lines changed

1 file changed

+24
-22
lines changed

.github/workflows/build-ci.yml

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ jobs:
77
build:
88
name: Build Windows
99
runs-on: windows-latest
10+
1011
steps:
1112
- name: Check out code
1213
uses: actions/checkout@v4
@@ -23,82 +24,83 @@ jobs:
2324
toolchain: stable
2425
override: true
2526

26-
# Ignore lines containing 'version = "x.x.x"' and hash the rest of Cargo.lock
27+
# Generate custom cache key from Cargo.toml
2728
- name: Generate custom cache key
28-
id: cargo-hash
29+
shell: bash
2930
run: |
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)"
31+
grep -v '^version = ' src-tauri/Cargo.toml | sha256sum | cut -d ' ' -f1 | tee cargo_hash.txt
32+
echo "CARGO_CACHE_KEY=$(cat cargo_hash.txt)" >> "$GITHUB_ENV"
3333
34+
# Cache Rust crates
3435
- name: Cache Cargo registry
3536
uses: actions/cache@v4
3637
with:
3738
path: ~/.cargo/registry
38-
key: ${{ runner.os }}-cargo-registry-${{ steps.cargo-hash.outputs.CARGO_CACHE_KEY }}
39+
key: ${{ runner.os }}-cargo-registry-${{ env.CARGO_CACHE_KEY }}
3940
restore-keys: |
4041
${{ runner.os }}-cargo-registry-
4142
4243
- name: Cache Cargo git index
4344
uses: actions/cache@v4
4445
with:
4546
path: ~/.cargo/git
46-
key: ${{ runner.os }}-cargo-git-${{ steps.cargo-hash.outputs.CARGO_CACHE_KEY }}
47+
key: ${{ runner.os }}-cargo-git-${{ env.CARGO_CACHE_KEY }}
4748
restore-keys: |
4849
${{ runner.os }}-cargo-git-
4950
5051
- name: Cache Cargo target directory
5152
uses: actions/cache@v4
5253
with:
5354
path: src-tauri/target
54-
key: ${{ runner.os }}-cargo-target-${{ matrix.target }}-${{ steps.cargo-hash.outputs.CARGO_CACHE_KEY }}-$(rustc --version)
55+
key: ${{ runner.os }}-cargo-target-${{ env.CARGO_CACHE_KEY }}-$(rustc --version)
5556
restore-keys: |
5657
${{ runner.os }}-cargo-target-
5758
58-
- name: Cache Tauri CLI (cross-platform)
59+
# Cache Tauri CLI binary
60+
- name: Cache Tauri CLI
5961
id: tauri-cli-cache
6062
uses: actions/cache@v4
6163
with:
6264
path: |
6365
~/.cargo/bin/cargo-tauri
6466
~/.cargo/bin/cargo-tauri.exe
65-
key: ${{ runner.os }}-tauri-cli-${{ steps.cargo-hash.outputs.CARGO_CACHE_KEY }}
67+
key: ${{ runner.os }}-tauri-cli-${{ env.CARGO_CACHE_KEY }}
6668
restore-keys: |
6769
${{ runner.os }}-tauri-cli-
6870
69-
- name: Cache pnpm store and modules
71+
# Cache only pnpm store, avoid node_modules symlink issues
72+
- name: Cache pnpm store
7073
uses: actions/cache@v4
7174
with:
72-
path: |
73-
~/.pnpm-store
74-
node_modules
75-
key: ${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
75+
path: ~/.pnpm-store
76+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('pnpm-lock.yaml') }}
7677
restore-keys: |
77-
${{ runner.os }}-pnpm-
78+
${{ runner.os }}-pnpm-store-
7879
79-
- name: Install Node Module
80+
# Install frontend dependencies
81+
- name: Install Node modules
8082
run: |
81-
npm i pnpm -g
83+
npm install -g pnpm
8284
echo "C:/Users/runneradmin/AppData/Roaming/npm" >> $GITHUB_PATH
83-
pnpm i
85+
pnpm install --frozen-lockfile --store ~/.pnpm-store
8486
8587
- name: Install Protoc
8688
uses: arduino/setup-protoc@v3
8789
with:
8890
version: "22.2"
8991

9092
- name: Install Tauri CLI if not cached
91-
run: cargo install tauri-cli --version ^2.0.0
9293
if: steps.tauri-cli-cache.outputs.cache-hit != 'true'
94+
run: cargo install tauri-cli --version ^2.0.0
9395

94-
- name: Build
96+
- name: Build with Tauri
9597
run: cargo tauri build
9698
working-directory: ./src-tauri
9799

98100
- name: Create output directory
99101
run: mkdir output
100102

101-
- name: Copy files to output
103+
- name: Copy executable
102104
run: cp src-tauri/target/release/bundle/nsis/*.exe output/
103105

104106
- name: Upload artifact

0 commit comments

Comments
 (0)