forked from Beaver-Notes/Beaver-Notes
-
Notifications
You must be signed in to change notification settings - Fork 0
166 lines (139 loc) · 5.37 KB
/
Copy pathossign-release-tauri.yml
File metadata and controls
166 lines (139 loc) · 5.37 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
name: Build and Package Tauri
on:
workflow_dispatch:
inputs:
source_branch:
description: 'The source branch or ref to build from'
default: 'main'
required: true
release_name:
description: 'The name for the release'
required: true
env:
NODE_VERSION: 22
jobs:
release:
runs-on: windows-latest
environment: OSSign
permissions:
contents: write
strategy:
matrix:
include:
- id: windows-x64
runner: windows-latest
rust_targets: 'x86_64-pc-windows-msvc'
tauri_target: 'x86_64-pc-windows-msvc'
asset_suffix: 'windows-x64'
- id: windows-arm64
runner: windows-11-arm
rust_targets: 'aarch64-pc-windows-msvc'
tauri_target: 'aarch64-pc-windows-msvc'
asset_suffix: 'windows-arm64'
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
repository: 'Beaver-Notes/Beaver-Notes'
ref: ${{ github.event.inputs.source_branch }}
fetch-depth: 1
# Should be fixed in source repository
# - name: Fix tauri
# shell: bash
# run: |
# jq '.bundle.windows.signCommand = "ossign.exe -t pecoff -o %1 %1"' src-tauri/tauri.conf.json > src-tauri/tauri.conf.json.tmp
# mv src-tauri/tauri.conf.json.tmp src-tauri/tauri.conf.json
- uses: ossign/ossign@main
with:
token: ${{ secrets.GITHUB_TOKEN }}
installOnly: true
# package.json is the source of truth for the release version.
- name: Read version from package.json
id: version
shell: bash
run: |
echo "version=$(node -p "require('./package.json').version")" >> "$GITHUB_OUTPUT"
- name: Setup Node with Yarn cache
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: yarn
# Use same yarn version everywhere
- name: Enable Corepack
shell: bash
run: |
corepack enable
corepack prepare yarn@stable --activate
yarn --version
# Install the Rust targets needed for each matrix job
- name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.rust_targets }}
- name: Rust cache
uses: Swatinem/rust-cache@v2
with:
workspaces: |
src-tauri -> target
- name: Install JS dependencies
shell: bash
run: |
yarn install --frozen-lockfile
# Fixed
#- name: Fix updater signing key (temporary)
# shell: bash
# run: |
# jq '.plugins.updater.pubkey = "${{ secrets.TAURI_SIGNING_PUBLIC_KEY }}"' src-tauri/tauri.conf.json > src-tauri/tauri.conf.json.tmp
# mv src-tauri/tauri.conf.json.tmp src-tauri/tauri.conf.json
- name: Build Windows bundles
shell: bash
env:
CI: 'true'
OSSIGN_CONFIG: ${{ secrets.OSSIGN_CONFIG }}
TAURI_SIGNING_PRIVATE_KEY: "${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}"
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: "${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}"
run: |
yarn tauri build --verbose --target "${{ matrix.tauri_target }}" --bundles nsis --ci
- name: Stage Windows assets
shell: pwsh
run: |
$ErrorActionPreference = "Stop"
$Version = "${{ steps.version.outputs.version }}"
$Target = "${{ matrix.rust_targets }}"
$OutDir = "release-assets"
New-Item -ItemType Directory -Force -Path $OutDir | Out-Null
Get-ChildItem "src-tauri/target/$Target/release/bundle" -Recurse -File |
Where-Object { $_.Extension -in ".exe", ".msi", ".sig", ".json", ".zip" } |
ForEach-Object { Copy-Item $_.FullName -Destination $OutDir -Force }
$Binary = "src-tauri/target/$Target/release/beaver-notes.exe"
$PortableName = "Beaver Notes-$Version-portable-${{ matrix.asset_suffix }}.zip"
Compress-Archive -Path $Binary -DestinationPath (Join-Path $OutDir $PortableName) -Force
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.asset_suffix }}
path: release-assets/*
if-no-files-found: error
publish:
runs-on: ubuntu-latest
needs: release
permissions:
contents: write
steps:
- name: Get artifacts (amd64)
uses: actions/download-artifact@v4
with:
path: dist-artifacts
merge-multiple: true
- name: Release
uses: softprops/action-gh-release@v2
with:
files: |
dist-artifacts/*
README.md
name: ${{ github.event.inputs.release_name }}
tag_name: ${{ github.run_id }}
body: |
# Signed Release ${{ github.event.inputs.release_name }}
These are the distributable files for the signed release of Beaver-Notes ${{ github.event.inputs.release_name }}
The source code was fetched from https://github.com/Beaver-Notes/Beaver-Notes@${{ github.event.inputs.source_branch }}