Skip to content

Commit 0fb1e79

Browse files
enowdevenowdev
authored andcommitted
ci(release): add multi-platform Tauri build and auto-release workflow
1 parent 16e9d04 commit 0fb1e79

1 file changed

Lines changed: 128 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
workflow_dispatch:
8+
inputs:
9+
version:
10+
description: 'Version tag (e.g. v0.1.0)'
11+
required: true
12+
default: 'v0.1.0'
13+
14+
concurrency:
15+
group: release-${{ github.ref }}
16+
cancel-in-progress: true
17+
18+
jobs:
19+
create-release:
20+
name: Create Release
21+
runs-on: ubuntu-latest
22+
outputs:
23+
release_id: ${{ steps.create-release.outputs.id }}
24+
version: ${{ steps.version.outputs.version }}
25+
steps:
26+
- uses: actions/checkout@v4
27+
28+
- name: Resolve version
29+
id: version
30+
run: |
31+
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
32+
VERSION="${{ github.event.inputs.version }}"
33+
else
34+
VERSION="${GITHUB_REF#refs/tags/}"
35+
fi
36+
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
37+
38+
- name: Create GitHub Release
39+
id: create-release
40+
env:
41+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42+
run: |
43+
VERSION="${{ steps.version.outputs.version }}"
44+
RELEASE_ID=$(gh release create "$VERSION" \
45+
--repo "${{ github.repository }}" \
46+
--title "$VERSION" \
47+
--generate-notes \
48+
--draft \
49+
--json id --jq '.id')
50+
echo "id=$RELEASE_ID" >> "$GITHUB_OUTPUT"
51+
52+
build:
53+
needs: create-release
54+
strategy:
55+
fail-fast: false
56+
matrix:
57+
include:
58+
- platform: macos-latest
59+
args: '--target aarch64-apple-darwin'
60+
target: aarch64-apple-darwin
61+
- platform: macos-latest
62+
args: '--target x86_64-apple-darwin'
63+
target: x86_64-apple-darwin
64+
- platform: ubuntu-22.04
65+
args: ''
66+
target: ''
67+
- platform: windows-latest
68+
args: ''
69+
target: ''
70+
71+
runs-on: ${{ matrix.platform }}
72+
name: Build (${{ matrix.platform }}${{ matrix.target && format(' / {0}', matrix.target) || '' }})
73+
74+
steps:
75+
- uses: actions/checkout@v4
76+
77+
- name: Setup Bun
78+
uses: oven-sh/setup-bun@v2
79+
80+
- name: Install Rust stable
81+
uses: dtolnay/rust-toolchain@stable
82+
with:
83+
targets: ${{ matrix.target }}
84+
85+
- name: Rust cache
86+
uses: Swatinem/rust-cache@v2
87+
with:
88+
workspaces: src-tauri
89+
90+
- name: Install system dependencies (Linux)
91+
if: matrix.platform == 'ubuntu-22.04'
92+
run: |
93+
sudo apt-get update
94+
sudo apt-get install -y \
95+
libwebkit2gtk-4.1-dev \
96+
libappindicator3-dev \
97+
librsvg2-dev \
98+
patchelf \
99+
libssl-dev \
100+
pkg-config
101+
102+
- name: Install frontend dependencies
103+
run: bun install --frozen-lockfile
104+
105+
- name: Build Tauri app
106+
uses: tauri-apps/tauri-action@v0
107+
env:
108+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
109+
with:
110+
tagName: ${{ needs.create-release.outputs.version }}
111+
releaseName: ${{ needs.create-release.outputs.version }}
112+
releaseBody: 'See assets below for download.'
113+
releaseDraft: true
114+
prerelease: false
115+
args: ${{ matrix.args }}
116+
117+
publish-release:
118+
name: Publish Release
119+
needs: [create-release, build]
120+
runs-on: ubuntu-latest
121+
steps:
122+
- name: Publish release
123+
env:
124+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
125+
run: |
126+
gh release edit "${{ needs.create-release.outputs.version }}" \
127+
--repo "${{ github.repository }}" \
128+
--draft=false

0 commit comments

Comments
 (0)