Skip to content

Commit 0e015dd

Browse files
committed
fix: release workflow
1 parent c281ff3 commit 0e015dd

1 file changed

Lines changed: 44 additions & 3 deletions

File tree

.github/workflows/release.yml

Lines changed: 44 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,12 @@ jobs:
2020
outputs:
2121
release_id: ${{ steps.create-release.outputs.id }}
2222
release_upload_url: ${{ steps.create-release.outputs.upload_url }}
23+
version: ${{ steps.get_version.outputs.version }}
2324
steps:
2425
- name: Checkout
2526
uses: actions/checkout@v4
27+
with:
28+
fetch-depth: 0
2629

2730
- name: Get version
2831
id: get_version
@@ -33,15 +36,48 @@ jobs:
3336
echo "version=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
3437
fi
3538
39+
- name: Get previous tag
40+
id: prev_tag
41+
run: |
42+
PREV_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "")
43+
echo "prev_tag=$PREV_TAG" >> $GITHUB_OUTPUT
44+
45+
- name: Generate changelog
46+
id: changelog
47+
run: |
48+
VERSION="${{ steps.get_version.outputs.version }}"
49+
PREV_TAG="${{ steps.prev_tag.outputs.prev_tag }}"
50+
REPO="${{ github.repository }}"
51+
52+
echo "## What's Changed" > changelog.md
53+
echo "" >> changelog.md
54+
55+
if [ -n "$PREV_TAG" ]; then
56+
# Get commits between previous tag and current
57+
git log ${PREV_TAG}..HEAD --pretty=format:"- %s ([%h](https://github.com/${REPO}/commit/%H))" >> changelog.md
58+
else
59+
# First release - get all commits
60+
git log --pretty=format:"- %s ([%h](https://github.com/${REPO}/commit/%H))" >> changelog.md
61+
fi
62+
63+
echo "" >> changelog.md
64+
echo "" >> changelog.md
65+
66+
if [ -n "$PREV_TAG" ]; then
67+
echo "**Full Changelog**: https://github.com/${REPO}/compare/${PREV_TAG}...${VERSION}" >> changelog.md
68+
fi
69+
70+
cat changelog.md
71+
3672
- name: Create Release
3773
id: create-release
3874
uses: softprops/action-gh-release@v2
3975
with:
4076
tag_name: ${{ steps.get_version.outputs.version }}
4177
name: Release ${{ steps.get_version.outputs.version }}
78+
body_path: changelog.md
4279
draft: true
4380
prerelease: false
44-
generate_release_notes: true
4581

4682
build-tauri:
4783
needs: create-release
@@ -78,10 +114,15 @@ jobs:
78114
bun-version: latest
79115

80116
- name: Setup Rust
81-
uses: dtolnay/rust-action@stable
117+
uses: dtolnay/rust-toolchain@stable
82118
with:
83119
targets: ${{ matrix.target }}
84120

121+
- name: Rust cache
122+
uses: Swatinem/rust-cache@v2
123+
with:
124+
workspaces: apps/desktop/src-tauri
125+
85126
- name: Install Linux dependencies
86127
if: matrix.platform == 'ubuntu-22.04'
87128
run: |
@@ -117,5 +158,5 @@ jobs:
117158
- name: Publish Release
118159
uses: softprops/action-gh-release@v2
119160
with:
120-
tag_name: ${{ github.ref_name }}
161+
tag_name: ${{ needs.create-release.outputs.version }}
121162
draft: false

0 commit comments

Comments
 (0)