-
Notifications
You must be signed in to change notification settings - Fork 0
156 lines (140 loc) · 4.86 KB
/
release.yml
File metadata and controls
156 lines (140 loc) · 4.86 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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
name: Release
on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
tag:
description: 'Tag to release (e.g., v1.0.0)'
required: true
type: string
jobs:
create-release:
runs-on: ubuntu-latest
permissions:
contents: write
outputs:
release_id: ${{ steps.create-release.outputs.id }}
upload_url: ${{ steps.create-release.outputs.upload_url }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ inputs.tag || github.ref }}
- name: Create Release
id: create-release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ inputs.tag || github.ref_name }}
draft: true
generate_release_notes: true
build-tauri:
needs: create-release
permissions:
contents: write
strategy:
fail-fast: false
matrix:
include:
- platform: windows-latest
args: ''
- platform: macos-latest
args: '--target aarch64-apple-darwin'
- platform: macos-latest
args: '--target x86_64-apple-darwin'
- platform: ubuntu-22.04
args: ''
runs-on: ${{ matrix.platform }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ inputs.tag || github.ref }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- name: Setup pnpm cache
uses: actions/cache@v4
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }}
- name: Rust cache
uses: swatinem/rust-cache@v2
with:
workspaces: './apps/desktop/src-tauri -> target'
- name: Install dependencies (Ubuntu only)
if: matrix.platform == 'ubuntu-22.04'
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
- name: Install frontend dependencies
run: pnpm install --frozen-lockfile
- name: Update version and pubkey from tag
shell: bash
env:
INPUT_TAG: ${{ inputs.tag }}
run: |
# Get tag from input or ref
if [[ -n "$INPUT_TAG" ]]; then
TAG_NAME="$INPUT_TAG"
else
TAG_NAME="$GITHUB_REF_NAME"
fi
VERSION="${TAG_NAME#v}"
echo "Updating version to $VERSION"
cd apps/desktop/src-tauri
# Update version
if [[ "$RUNNER_OS" == "Windows" ]]; then
sed -i "s/\"version\": \"[^\"]*\"/\"version\": \"$VERSION\"/" tauri.conf.json
else
sed -i '' "s/\"version\": \"[^\"]*\"/\"version\": \"$VERSION\"/" tauri.conf.json || \
sed -i "s/\"version\": \"[^\"]*\"/\"version\": \"$VERSION\"/" tauri.conf.json
fi
# Update pubkey if provided
if [[ -n "${{ secrets.TAURI_SIGNING_PUBLIC_KEY }}" ]]; then
if [[ "$RUNNER_OS" == "Windows" ]]; then
sed -i "s/\"pubkey\": \"[^\"]*\"/\"pubkey\": \"${{ secrets.TAURI_SIGNING_PUBLIC_KEY }}\"/" tauri.conf.json
else
sed -i '' "s/\"pubkey\": \"[^\"]*\"/\"pubkey\": \"${{ secrets.TAURI_SIGNING_PUBLIC_KEY }}\"/" tauri.conf.json || \
sed -i "s/\"pubkey\": \"[^\"]*\"/\"pubkey\": \"${{ secrets.TAURI_SIGNING_PUBLIC_KEY }}\"/" tauri.conf.json
fi
fi
cat tauri.conf.json | grep -E "version|pubkey"
- name: Build Tauri app
uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
with:
releaseId: ${{ needs.create-release.outputs.release_id }}
projectPath: './apps/desktop'
tauriScript: 'pnpm tauri'
args: ${{ matrix.args }}
includeUpdaterJson: true
publish-release:
needs: [create-release, build-tauri]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Publish release
uses: eregon/publish-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
release_id: ${{ needs.create-release.outputs.release_id }}