Skip to content

Commit 4e4a2bf

Browse files
committed
fix: release
1 parent 0e015dd commit 4e4a2bf

2 files changed

Lines changed: 79 additions & 108 deletions

File tree

.github/workflows/release.yml

Lines changed: 76 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -3,110 +3,43 @@ name: Release
33
on:
44
push:
55
tags:
6-
- 'v*'
7-
workflow_dispatch:
8-
inputs:
9-
version:
10-
description: 'Version tag (e.g., v1.0.0)'
11-
required: true
12-
type: string
6+
- "v*"
137

14-
permissions:
15-
contents: write
8+
env:
9+
CARGO_TERM_COLOR: always
1610

1711
jobs:
18-
create-release:
19-
runs-on: ubuntu-latest
20-
outputs:
21-
release_id: ${{ steps.create-release.outputs.id }}
22-
release_upload_url: ${{ steps.create-release.outputs.upload_url }}
23-
version: ${{ steps.get_version.outputs.version }}
24-
steps:
25-
- name: Checkout
26-
uses: actions/checkout@v4
27-
with:
28-
fetch-depth: 0
29-
30-
- name: Get version
31-
id: get_version
32-
run: |
33-
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
34-
echo "version=${{ inputs.version }}" >> $GITHUB_OUTPUT
35-
else
36-
echo "version=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
37-
fi
38-
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-
72-
- name: Create Release
73-
id: create-release
74-
uses: softprops/action-gh-release@v2
75-
with:
76-
tag_name: ${{ steps.get_version.outputs.version }}
77-
name: Release ${{ steps.get_version.outputs.version }}
78-
body_path: changelog.md
79-
draft: true
80-
prerelease: false
81-
82-
build-tauri:
83-
needs: create-release
12+
release:
13+
name: Release (${{ matrix.name }})
14+
permissions:
15+
contents: write
8416
strategy:
8517
fail-fast: false
8618
matrix:
8719
include:
88-
# macOS builds
8920
- platform: macos-latest
9021
target: aarch64-apple-darwin
22+
args: --target aarch64-apple-darwin
9123
name: macOS (Apple Silicon)
9224
- platform: macos-latest
9325
target: x86_64-apple-darwin
26+
args: --target x86_64-apple-darwin
9427
name: macOS (Intel)
95-
# Windows build
96-
- platform: windows-latest
97-
target: x86_64-pc-windows-msvc
98-
name: Windows (x64)
99-
# Linux build
10028
- platform: ubuntu-22.04
10129
target: x86_64-unknown-linux-gnu
102-
name: Linux (x64)
30+
args: ""
31+
name: Linux
32+
- platform: windows-latest
33+
target: x86_64-pc-windows-msvc
34+
args: ""
35+
name: Windows
10336

10437
runs-on: ${{ matrix.platform }}
105-
name: Build ${{ matrix.name }}
106-
10738
steps:
10839
- name: Checkout
10940
uses: actions/checkout@v4
41+
with:
42+
fetch-depth: 0
11043

11144
- name: Setup Bun
11245
uses: oven-sh/setup-bun@v2
@@ -116,47 +49,83 @@ jobs:
11649
- name: Setup Rust
11750
uses: dtolnay/rust-toolchain@stable
11851
with:
119-
targets: ${{ matrix.target }}
120-
121-
- name: Rust cache
122-
uses: Swatinem/rust-cache@v2
123-
with:
124-
workspaces: apps/desktop/src-tauri
52+
targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }}
12553

12654
- name: Install Linux dependencies
12755
if: matrix.platform == 'ubuntu-22.04'
12856
run: |
12957
sudo apt-get update
13058
sudo apt-get install -y \
13159
libwebkit2gtk-4.1-dev \
132-
libappindicator3-dev \
60+
libayatana-appindicator3-dev \
13361
librsvg2-dev \
13462
patchelf \
135-
libssl-dev \
136-
libgtk-3-dev \
137-
libayatana-appindicator3-dev
63+
libgtk-3-dev
64+
65+
- name: Rust cache
66+
uses: Swatinem/rust-cache@v2
67+
with:
68+
workspaces: apps/desktop/src-tauri
13869

13970
- name: Install dependencies
14071
run: bun install
14172
working-directory: apps/desktop
14273

143-
- name: Build Tauri app
74+
- name: Get previous tag
75+
id: prev_tag
76+
shell: bash
77+
run: |
78+
PREV_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "")
79+
echo "prev_tag=$PREV_TAG" >> $GITHUB_OUTPUT
80+
81+
- name: Generate changelog
82+
id: changelog
83+
shell: bash
84+
run: |
85+
VERSION="${GITHUB_REF#refs/tags/}"
86+
PREV_TAG="${{ steps.prev_tag.outputs.prev_tag }}"
87+
REPO="${{ github.repository }}"
88+
89+
BODY="## What's Changed"$'\n\n'
90+
91+
if [ -n "$PREV_TAG" ]; then
92+
COMMITS=$(git log ${PREV_TAG}..HEAD --pretty=format:"- %s ([%h](https://github.com/${REPO}/commit/%H))")
93+
BODY+="$COMMITS"$'\n\n'
94+
BODY+="**Full Changelog**: https://github.com/${REPO}/compare/${PREV_TAG}...${VERSION}"
95+
else
96+
COMMITS=$(git log --pretty=format:"- %s ([%h](https://github.com/${REPO}/commit/%H))")
97+
BODY+="$COMMITS"
98+
fi
99+
100+
# Escape for GitHub Actions output
101+
BODY="${BODY//'%'/'%25'}"
102+
BODY="${BODY//$'\n'/'%0A'}"
103+
BODY="${BODY//$'\r'/'%0D'}"
104+
105+
echo "body=$BODY" >> $GITHUB_OUTPUT
106+
107+
- name: Build and release
144108
uses: tauri-apps/tauri-action@v0
145109
env:
146110
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
147111
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
148112
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
149113
with:
150114
projectPath: apps/desktop
151-
releaseId: ${{ needs.create-release.outputs.release_id }}
152-
args: --target ${{ matrix.target }}
153-
154-
publish-release:
155-
needs: [create-release, build-tauri]
156-
runs-on: ubuntu-latest
157-
steps:
158-
- name: Publish Release
159-
uses: softprops/action-gh-release@v2
160-
with:
161-
tag_name: ${{ needs.create-release.outputs.version }}
162-
draft: false
115+
tauriScript: bunx tauri
116+
tagName: ${{ github.ref_name }}
117+
releaseName: "youtube.pub ${{ github.ref_name }}"
118+
releaseBody: |
119+
${{ steps.changelog.outputs.body }}
120+
121+
## Downloads
122+
123+
| Platform | Download |
124+
|----------|----------|
125+
| macOS (Apple Silicon) | `.dmg` (arm64) |
126+
| macOS (Intel) | `.dmg` (x64) |
127+
| Windows | `.exe` / `.msi` installer |
128+
| Linux | `.deb` / `.AppImage` |
129+
releaseDraft: false
130+
prerelease: false
131+
args: ${{ matrix.args }}

apps/desktop/src/lib/image-file-utils.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ export const IMAGE_EXTENSIONS = ["png", "jpg", "jpeg", "webp", "gif"];
88
* Convert a Uint8Array to a data URL string.
99
*/
1010
export function fileToDataUrl(data: Uint8Array): Promise<string> {
11-
const blob = new Blob([data]);
11+
const blob = new Blob([
12+
data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength),
13+
]);
1214
return new Promise<string>((resolve) => {
1315
const reader = new FileReader();
1416
reader.onloadend = () => resolve(reader.result as string);

0 commit comments

Comments
 (0)