-
Notifications
You must be signed in to change notification settings - Fork 68
136 lines (117 loc) · 4.14 KB
/
desktop-release.yml
File metadata and controls
136 lines (117 loc) · 4.14 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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
name: Desktop Pet Release
on:
push:
tags:
- 'desktop-v*'
permissions:
contents: write
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- platform: macos-latest
rust-target: aarch64-apple-darwin
tauri-args: --target aarch64-apple-darwin
- platform: macos-latest
rust-target: x86_64-apple-darwin
tauri-args: --target x86_64-apple-darwin
- platform: ubuntu-22.04
rust-target: x86_64-unknown-linux-gnu
tauri-args: ""
- platform: windows-latest
rust-target: x86_64-pc-windows-msvc
tauri-args: ""
runs-on: ${{ matrix.platform }}
defaults:
run:
shell: bash
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.rust-target }}
- name: Rust cache
uses: swatinem/rust-cache@v2
with:
workspaces: desktop/src-tauri
- name: Install Linux dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y \
libwebkit2gtk-4.1-dev \
libappindicator3-dev \
librsvg2-dev \
patchelf \
libgtk-3-dev \
libsoup-3.0-dev \
libjavascriptcoregtk-4.1-dev \
libxdo-dev \
libfuse2 \
libssl-dev
- name: Install frontend dependencies
working-directory: desktop
run: npm install
- name: Build Tauri app
working-directory: desktop
run: npx tauri build ${{ matrix.tauri-args }}
- name: Determine arch and os
id: meta
run: |
case "${{ matrix.rust-target }}" in
aarch64-apple-darwin) echo "arch=aarch64" >> "$GITHUB_OUTPUT"; echo "os=macos" >> "$GITHUB_OUTPUT" ;;
x86_64-apple-darwin) echo "arch=x64" >> "$GITHUB_OUTPUT"; echo "os=macos" >> "$GITHUB_OUTPUT" ;;
x86_64-unknown-linux-gnu) echo "arch=x64" >> "$GITHUB_OUTPUT"; echo "os=linux" >> "$GITHUB_OUTPUT" ;;
x86_64-pc-windows-msvc) echo "arch=x64" >> "$GITHUB_OUTPUT"; echo "os=windows" >> "$GITHUB_OUTPUT" ;;
esac
- name: Collect and rename artifacts (macOS)
if: runner.os == 'macOS'
run: |
mkdir -p artifacts
DMG=$(find desktop/src-tauri/target -name '*.dmg' | head -1)
cp "$DMG" "artifacts/cccc-desktop-pet_${{ steps.meta.outputs.os }}_${{ steps.meta.outputs.arch }}.dmg"
- name: Collect and rename artifacts (Windows)
if: runner.os == 'Windows'
run: |
mkdir -p artifacts
EXE=$(find desktop/src-tauri/target -name '*-setup.exe' | head -1)
cp "$EXE" "artifacts/cccc-desktop-pet_${{ steps.meta.outputs.os }}_${{ steps.meta.outputs.arch }}-setup.exe"
- name: Collect and rename artifacts (Linux)
if: runner.os == 'Linux'
run: |
mkdir -p artifacts
DEB=$(find desktop/src-tauri/target -name '*.deb' | head -1)
cp "$DEB" "artifacts/cccc-desktop-pet_${{ steps.meta.outputs.os }}_${{ steps.meta.outputs.arch }}.deb"
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: desktop-${{ matrix.rust-target }}
path: artifacts/*
if-no-files-found: error
release:
needs: build
runs-on: ubuntu-latest
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: all-artifacts
pattern: desktop-*
merge-multiple: true
- name: List artifacts
run: ls -lR all-artifacts/
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
files: all-artifacts/*
generate_release_notes: true
draft: false
prerelease: ${{ contains(github.ref_name, 'rc') || contains(github.ref_name, 'beta') || contains(github.ref_name, 'alpha') }}