-
Notifications
You must be signed in to change notification settings - Fork 0
186 lines (164 loc) · 5.83 KB
/
release.yml
File metadata and controls
186 lines (164 loc) · 5.83 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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
name: Release
on:
workflow_dispatch:
inputs:
branch:
description: 'Branch to release from'
required: false
default: 'main'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test-build:
name: Test Build
permissions:
contents: read
uses: ./.github/workflows/build.yml
with:
branch: ${{ inputs.branch }}
format:
name: Code Formatting
needs: test-build
permissions:
contents: write
uses: ./.github/workflows/format.yml
semantic-release:
name: Semantic Release
needs: format
runs-on: ubuntu-latest
outputs:
release_tag: ${{ steps.set_outputs.outputs.release_tag }}
release_body: ${{ steps.set_outputs.outputs.release_body }}
release_draft: ${{ steps.set_outputs.outputs.release_draft }}
release_prerelease: ${{ steps.set_outputs.outputs.release_prerelease }}
release_released: ${{ steps.set_outputs.outputs.release_released }}
permissions:
contents: write
issues: write
pull-requests: write
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
ref: ${{ github.event.inputs.branch || 'main' }}
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10.16.1
- name: Setup Node
uses: actions/setup-node@v6
with:
node-version: lts/*
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Release
id: release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: pnpm exec semantic-release --no-ci || true
- name: Set release outputs
id: set_outputs
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
LATEST_TAG=$(gh release list --limit 1 --json tagName -q '.[0].tagName')
if [ -n "$LATEST_TAG" ]; then
RELEASE_INFO=$(gh release view "$LATEST_TAG" --json tagName,name,body,isDraft,isPrerelease)
TAG=$(echo "$RELEASE_INFO" | jq -r '.tagName')
NAME=$(echo "$RELEASE_INFO" | jq -r '.name')
BODY=$(echo "$RELEASE_INFO" | jq -r '.body')
DRAFT=$(echo "$RELEASE_INFO" | jq -r '.isDraft')
PRERELEASE=$(echo "$RELEASE_INFO" | jq -r '.isPrerelease')
echo "release_tag=$TAG" >> $GITHUB_OUTPUT
echo "release_body<<EOF" >> $GITHUB_OUTPUT
echo "$BODY" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
echo "release_draft=$DRAFT" >> $GITHUB_OUTPUT
echo "release_prerelease=$PRERELEASE" >> $GITHUB_OUTPUT
echo "release_released=true" >> $GITHUB_OUTPUT
else
echo "release_tag=" >> $GITHUB_OUTPUT
echo "release_body=" >> $GITHUB_OUTPUT
echo "release_draft=false" >> $GITHUB_OUTPUT
echo "release_prerelease=false" >> $GITHUB_OUTPUT
echo "release_released=false" >> $GITHUB_OUTPUT
fi
tauri-release:
name: Tauri Release
needs: semantic-release
if: needs.semantic-release.outputs.release_released == 'true'
permissions:
contents: write
strategy:
fail-fast: false
matrix:
include:
- platform: 'macos-latest'
args: '--target aarch64-apple-darwin'
- platform: 'macos-latest'
args: '--target x86_64-apple-darwin'
- platform: 'ubuntu-22.04'
args: ''
- platform: 'windows-latest'
args: ''
runs-on: ${{ matrix.platform }}
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
ref: ${{ github.event.inputs.branch || 'main' }}
- name: install dependencies (ubuntu only)
if: matrix.platform == 'ubuntu-22.04' # This must match the platform value defined above.
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10.16.1
- name: Setup Node
uses: actions/setup-node@v6
with:
node-version: lts/*
cache: 'pnpm'
- name: Cache Rust crates
uses: actions/cache@v5
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo
restore-keys: |
${{ runner.os }}-cargo
- name: Install Rust + Targets
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }}
- name: Install frontend deps
run: pnpm install --frozen-lockfile
- name: Build & Publish Tauri
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 }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
with:
tagName: ${{ needs.semantic-release.outputs.release_tag }}
releaseName: ${{ needs.semantic-release.outputs.release_tag }}
releaseBody: ${{ needs.semantic-release.outputs.release_body }}
releaseDraft: ${{ needs.semantic-release.outputs.release_draft == 'true' }}
prerelease: ${{ needs.semantic-release.outputs.release_prerelease == 'true' }}
args: ${{ matrix.args }}
- name: Cache Tauri target folder
uses: actions/cache@v5
with:
path: src-tauri/target
key: ${{ runner.os }}-tauri-target
restore-keys: |
${{ runner.os }}-tauri-target