Skip to content

Commit 6381d58

Browse files
committed
💚 CI跨平台兼容
1 parent 0f9e3cf commit 6381d58

File tree

2 files changed

+26
-6
lines changed

2 files changed

+26
-6
lines changed

.github/workflows/nightly.yml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,20 @@ jobs:
5555
# If you don't have `beforeBuildCommand` configured you may want to build your frontend here too.
5656
run: pnpm install # change this to npm or pnpm depending on which one you use.
5757

58-
- name: edit version
58+
- name: edit version (linux only)
59+
if: matrix.platform == 'ubuntu-22.04' # This must match the platform value defined above.
60+
run: |
61+
sed -i "s/\"version\": \"[^\"]*\"/\"version\": \"0.0.0-nightly.${{ github.sha }}\"/" src-tauri/tauri.conf.json
62+
63+
- name: edit version (macos only)
64+
if: matrix.platform == 'macos-latest' # This must match the platform value defined above.
65+
run: |
66+
sed -i '' "s/\"version\": \"[^\"]*\"/\"version\": \"0.0.0-nightly.${{ github.sha }}\"/" src-tauri/tauri.conf.json
67+
68+
- name: edit version (windows only)
69+
if: matrix.platform == 'windows-latest' # This must match the platform value defined above.
5970
run: |
60-
# 修改src-tauri/tauri.conf.json中的version字段,修改为0.0.0-nightly.<commit>
61-
sed -i "" "s/\"version\": \"[^\"]*\"/\"version\": \"0.0.0-nightly.${{ github.sha }}\"/" src-tauri/tauri.conf.json
71+
(Get-Content src-tauri\tauri.conf.json).replace('"version": ".*"', '"version": "0.0.0-nightly.${{ github.sha }}"') | Set-Content src-tauri\tauri.conf.json
6272
6373
- uses: tauri-apps/tauri-action@v0
6474
env:

.github/workflows/release.yml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,20 @@ jobs:
5858
# If you don't have `beforeBuildCommand` configured you may want to build your frontend here too.
5959
run: pnpm install # change this to npm or pnpm depending on which one you use.
6060

61-
- name: edit version
61+
- name: edit version (linux only)
62+
if: matrix.platform == 'ubuntu-22.04' # This must match the platform value defined above.
63+
run: |
64+
sed -i "s/\"version\": \"[^\"]*\"/\"version\": \"${{ github.event.inputs.version }}\"/" src-tauri/tauri.conf.json
65+
66+
- name: edit version (macos only)
67+
if: matrix.platform == 'macos-latest' # This must match the platform value defined above.
68+
run: |
69+
sed -i '' "s/\"version\": \"[^\"]*\"/\"version\": \"${{ github.event.inputs.version }}\"/" src-tauri/tauri.conf.json
70+
71+
- name: edit version (windows only)
72+
if: matrix.platform == 'windows-latest' # This must match the platform value defined above.
6273
run: |
63-
# 修改src-tauri/tauri.conf.json中的version字段,修改为发布的版本号
64-
sed -i "" "s/\"version\": \"[^\"]*\"/\"version\": \"${{ github.event.inputs.version }}\"/" src-tauri/tauri.conf.json
74+
(Get-Content src-tauri\tauri.conf.json).replace('"version": ".*"', '"version": "${{ github.event.inputs.version }}"') | Set-Content src-tauri\tauri.conf.json
6575
6676
- uses: tauri-apps/tauri-action@v0
6777
env:

0 commit comments

Comments
 (0)