-
Notifications
You must be signed in to change notification settings - Fork 8
113 lines (106 loc) · 3.21 KB
/
Copy pathrelease.yml
File metadata and controls
113 lines (106 loc) · 3.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
name: Build & Release
on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
tag:
description: 'Release tag (e.g. v4.0.0)'
required: true
default: 'v4.0.0'
jobs:
verify:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
- run: npm ci
- name: Type check frontend
run: npx tsc --noEmit
- name: Run tests
run: npm test
build-linux:
needs: verify
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
- uses: dtolnay/rust-toolchain@stable
- name: Install Linux build dependencies
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
- run: npm ci
- name: Build Tauri app
run: npx tauri build
- uses: actions/upload-artifact@v4
with:
name: linux-packages
path: |
src-tauri/target/release/bundle/appimage/*.AppImage
src-tauri/target/release/bundle/deb/*.deb
build-windows:
needs: verify
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
- uses: dtolnay/rust-toolchain@stable
- run: npm ci
- name: Build Tauri app
run: npx tauri build
- uses: actions/upload-artifact@v4
with:
name: windows-installer
path: src-tauri/target/release/bundle/nsis/*.exe
publish-release:
needs: [build-linux, build-windows]
if: needs.build-linux.result == 'success' && needs.build-windows.result == 'success'
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/download-artifact@v4
with:
path: release-artifacts
merge-multiple: true
- name: Resolve tag name
id: tag
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "name=${{ github.event.inputs.tag }}" >> $GITHUB_OUTPUT
else
echo "name=${{ github.ref_name }}" >> $GITHUB_OUTPUT
fi
- name: Create GitHub Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
tag="${{ steps.tag.outputs.name }}"
mapfile -t files < <(find release-artifacts -type f \( -name "*.AppImage" -o -name "*.deb" -o -name "*.exe" \) | sort)
if [ "${#files[@]}" -eq 0 ]; then
echo "No release artifacts found."
exit 1
fi
if gh release view "$tag" --repo "$GITHUB_REPOSITORY" &>/dev/null; then
echo "Release $tag already exists — uploading artifacts"
gh release upload "$tag" "${files[@]}" \
--repo "$GITHUB_REPOSITORY" \
--clobber
else
echo "Creating release $tag"
gh release create "$tag" "${files[@]}" \
--repo "$GITHUB_REPOSITORY" \
--title "$tag" \
--latest
fi