-
Notifications
You must be signed in to change notification settings - Fork 0
172 lines (149 loc) · 5.35 KB
/
release.yml
File metadata and controls
172 lines (149 loc) · 5.35 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
name: Release Desktop Builds
on:
release:
types:
- published
workflow_dispatch:
inputs:
tag_name:
description: Release tag to publish, for example v1.0.0
required: true
type: string
release_name:
description: Optional GitHub release title
required: false
type: string
draft:
description: Create the release as a draft when dispatched manually
required: false
default: false
type: boolean
prerelease:
description: Mark the release as a prerelease when dispatched manually
required: false
default: false
type: boolean
permissions:
contents: write
concurrency:
group: release-${{ github.event.release.tag_name || inputs.tag_name || github.ref }}
cancel-in-progress: false
jobs:
build-release:
strategy:
fail-fast: false
matrix:
include:
- platform: macos-latest
args: '--target aarch64-apple-darwin'
rustTargets: 'aarch64-apple-darwin,x86_64-apple-darwin'
- platform: macos-latest
args: '--target x86_64-apple-darwin'
rustTargets: 'aarch64-apple-darwin,x86_64-apple-darwin'
- platform: windows-latest
args: ''
rustTargets: ''
runs-on: ${{ matrix.platform }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
cache-dependency-path: |
package-lock.json
ui/package-lock.json
- name: Install root dependencies
run: npm ci
- name: Install UI dependencies
run: npm --prefix ui ci
- name: Set up Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.rustTargets }}
- name: Restore Rust cache
uses: swatinem/rust-cache@v2
with:
workspaces: |
src-tauri -> target
- name: Resolve release metadata
id: release_meta
shell: bash
run: |
if [[ "${{ github.event_name }}" == "release" ]]; then
tag_name="${{ github.event.release.tag_name }}"
release_name="${{ github.event.release.name }}"
draft_value="${{ github.event.release.draft }}"
prerelease_value="${{ github.event.release.prerelease }}"
else
tag_name="${{ inputs.tag_name }}"
release_name="${{ inputs.release_name }}"
draft_value="${{ inputs.draft }}"
prerelease_value="${{ inputs.prerelease }}"
fi
if [[ -z "$tag_name" ]]; then
echo "Release tag name is required." >&2
exit 1
fi
if [[ -z "$release_name" ]]; then
release_name="Shot ${tag_name}"
fi
echo "tag_name=$tag_name" >> "$GITHUB_OUTPUT"
echo "release_name=$release_name" >> "$GITHUB_OUTPUT"
echo "draft_value=$draft_value" >> "$GITHUB_OUTPUT"
echo "prerelease_value=$prerelease_value" >> "$GITHUB_OUTPUT"
- name: Resolve build options
id: build_options
shell: bash
run: |
resolved_args='${{ matrix.args }}'
include_updater_json=false
if [[ -n '${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}' ]]; then
include_updater_json=true
fi
{
echo "include_updater_json=$include_updater_json"
echo 'resolved_args<<EOF'
echo "$resolved_args"
echo 'EOF'
} >> "$GITHUB_OUTPUT"
- name: Disable updater artifacts for unsigned builds
shell: bash
env:
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
run: |
if [[ -n "$TAURI_SIGNING_PRIVATE_KEY" ]]; then
exit 0
fi
node <<'NODE'
const fs = require('fs');
const filePath = 'src-tauri/tauri.conf.json';
const config = JSON.parse(fs.readFileSync(filePath, 'utf8'));
config.bundle = {
...(config.bundle || {}),
createUpdaterArtifacts: false,
};
fs.writeFileSync(filePath, `${JSON.stringify(config, null, 2)}\n`);
NODE
- name: Build and publish desktop release
uses: tauri-apps/tauri-action@v0.6.2
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:
projectPath: .
tagName: ${{ steps.release_meta.outputs.tag_name }}
releaseName: ${{ steps.release_meta.outputs.release_name }}
releaseBody: Desktop installers and updater artifacts for Shot.
releaseCommitish: ${{ github.sha }}
releaseDraft: ${{ steps.release_meta.outputs.draft_value }}
prerelease: ${{ steps.release_meta.outputs.prerelease_value }}
tauriScript: npm run tauri --
includeUpdaterJson: ${{ steps.build_options.outputs.include_updater_json }}
args: ${{ steps.build_options.outputs.resolved_args }}
uploadPlainBinary: false
updaterJsonPreferNsis: true
assetNamePattern: 'Shot_[platform]_[arch][ext]'