Skip to content

Commit 2ac8156

Browse files
Fix run shell (#730)
* fix: windows platform run with shell * chore: add rust target * fix: fix app version and release body * chore: update step id --------- Co-authored-by: hardy <luohf@infinilabs.com>
1 parent b004670 commit 2ac8156

File tree

1 file changed

+33
-7
lines changed

1 file changed

+33
-7
lines changed

.github/workflows/release.yml

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,16 @@ on:
99
jobs:
1010
create-release:
1111
runs-on: ubuntu-latest
12+
13+
outputs:
14+
APP_VERSION: ${{ steps.get-version.outputs.APP_VERSION }}
15+
RELEASE_BODY: ${{ steps.get-changelog.outputs.RELEASE_BODY }}
16+
1217
steps:
1318
- uses: actions/checkout@v4
1419
with:
1520
fetch-depth: 0
21+
1622
- name: Set output
1723
id: vars
1824
run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
@@ -22,11 +28,28 @@ jobs:
2228
with:
2329
node-version: 20
2430

31+
- name: Get build version
32+
shell: bash
33+
id: get-version
34+
run: |
35+
PACKAGE_VERSION=$(jq -r '.version' package.json)
36+
CARGO_VERSION=$(grep -m 1 '^version =' src-tauri/Cargo.toml | sed -E 's/.*"([^"]+)".*/\1/')
37+
if [ "$PACKAGE_VERSION" != "$CARGO_VERSION" ]; then
38+
echo "::error::Version mismatch!"
39+
else
40+
echo "Version match: $PACKAGE_VERSION"
41+
fi
42+
echo "APP_VERSION=$PACKAGE_VERSION" >> $GITHUB_OUTPUT
43+
2544
- name: Generate changelog
26-
id: create_release
27-
run: npx changelogithub --draft --name ${{ steps.vars.outputs.tag }}
45+
id: get-changelog
46+
run: |
47+
CHANGELOG_BODY=$(npx changelogithub --draft --name ${{ steps.vars.outputs.tag }})
48+
echo "RELEASE_BODY<<EOF" >> $GITHUB_OUTPUT
49+
echo "$CHANGELOG_BODY" >> $GITHUB_OUTPUT
50+
echo "EOF" >> $GITHUB_OUTPUT
2851
env:
29-
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
52+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3053

3154
build-app:
3255
needs: create-release
@@ -52,6 +75,9 @@ jobs:
5275
target: "x86_64-unknown-linux-gnu"
5376
- platform: "ubuntu-22.04-arm"
5477
target: "aarch64-unknown-linux-gnu"
78+
env:
79+
APP_VERSION: ${{ needs.create-release.outputs.APP_VERSION }}
80+
RELEASE_BODY: ${{ needs.create-release.outputs.RELEASE_BODY }}
5581

5682
runs-on: ${{ matrix.platform }}
5783
steps:
@@ -81,7 +107,7 @@ jobs:
81107
sudo apt-get update
82108
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf xdg-utils
83109
84-
- name: Add Rust build target for ${{ matrix.target }}
110+
- name: Add Rust build target at ${{ matrix.platform}} for ${{ matrix.target }}
85111
working-directory: src-tauri
86112
shell: bash
87113
run: |
@@ -115,7 +141,7 @@ jobs:
115141
- name: Install app dependencies and build web
116142
run: pnpm install --frozen-lockfile
117143

118-
- name: Build the app with ${{ matrix.platform }}
144+
- name: Build the coco at ${{ matrix.platform}} for ${{ matrix.target }} @ ${{ env.APP_VERSION }}
119145
uses: tauri-apps/tauri-action@v0
120146
env:
121147
CI: false
@@ -131,8 +157,8 @@ jobs:
131157
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
132158
with:
133159
tagName: ${{ github.ref_name }}
134-
releaseName: Coco ${{ needs.create-release.outputs.APP_VERSION }}
135-
releaseBody: ""
160+
releaseName: Coco ${{ env.APP_VERSION }}
161+
releaseBody: "${{ env.RELEASE_BODY }}"
136162
releaseDraft: true
137163
prerelease: false
138164
args: ${{ env.BUILD_ARGS }}

0 commit comments

Comments
 (0)