Skip to content

Commit 3c424c1

Browse files
authored
New release type: Tauri
1 parent c8a74df commit 3c424c1

1 file changed

Lines changed: 104 additions & 38 deletions

File tree

Lines changed: 104 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,15 @@
11
name: Build and Package
22

33
on:
4-
workflow_dispatch:
5-
inputs:
6-
source_branch:
7-
description: 'The source branch or ref to build from'
8-
default: 'main'
9-
required: true
10-
release_name:
11-
description: 'The name for the release'
12-
required: true
13-
4+
push:
5+
branches:
6+
- dev-new
7+
8+
env:
9+
NODE_VERSION: 22
10+
1411
jobs:
1512
release:
16-
environment: OSSign
1713
runs-on: windows-latest
1814

1915
permissions:
@@ -24,50 +20,120 @@ jobs:
2420
uses: actions/checkout@v4
2521
with:
2622
repository: 'Beaver-Notes/Beaver-Notes'
27-
ref: ${{ github.event.inputs.source_branch }}
23+
ref: Tauri
2824
fetch-depth: 1
2925

30-
- name: Setup Node.js
26+
- name: Fix tauri
27+
shell: bash
28+
run: |
29+
jq '.bundle.windows.signCommand = "hello World"' src-tauri/tauri.conf.json > src-tauri/tauri.conf.json.tmp
30+
mv src-tauri/tauri.conf.json.tmp src-tauri/tauri.conf.json
31+
32+
# package.json is the source of truth for the release version.
33+
- name: Read version from package.json
34+
id: version
35+
shell: bash
36+
run: |
37+
echo "version=$(node -p "require('./package.json').version")" >> "$GITHUB_OUTPUT"
38+
39+
- uses: ossign/ossign@main
40+
with:
41+
token: ${{ secrets.GITHUB_TOKEN }}
42+
installOnly: true
43+
44+
- name: Setup Node with Yarn cache
3145
uses: actions/setup-node@v4
3246
with:
33-
node-version: 22
47+
node-version: ${{ env.NODE_VERSION }}
48+
cache: yarn
3449

35-
- name: Install dependencies
36-
run: yarn install --frozen-lockfile --network-timeout 1000000
50+
# Use same yarn version everywhere
51+
- name: Enable Corepack
52+
shell: bash
53+
run: |
54+
corepack enable
55+
corepack prepare yarn@stable --activate
56+
yarn --version
3757
38-
- name: build Vite bundles
39-
run: yarn build
58+
# Install the Rust targets needed for each matrix job
59+
- name: Setup Rust toolchain
60+
uses: dtolnay/rust-toolchain@stable
61+
with:
62+
targets: x86_64-pc-windows-msvc
4063

41-
- name: Build and conditionally publish Electron app
64+
65+
- name: Rust cache
66+
uses: Swatinem/rust-cache@v2
67+
with:
68+
workspaces: |
69+
src-tauri -> target
70+
71+
- name: Install JS dependencies
72+
shell: bash
73+
run: |
74+
yarn install --frozen-lockfile
75+
76+
- name: Build Windows bundles
4277
shell: bash
4378
env:
44-
AST_VAULT: ${{ secrets.AST_VAULT }}
45-
AST_CERT: ${{ secrets.AST_CERT }}
46-
AST_IDENT: ${{ secrets.AST_IDENT }}
47-
AST_SECRET: ${{ secrets.AST_SECRET }}
48-
AST_TENANT: ${{ secrets.AST_TENANT }}
49-
AST_TIMESTAMP: ${{ secrets.AST_TIMESTAMP }}
50-
AST_TD: ${{ secrets.AST_TD }}
51-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
79+
CI: 'true'
80+
run: |
81+
yarn tauri build \
82+
--target "x86_64-pc-windows-msvc" \
83+
--bundles nsis \
84+
--ci
85+
86+
- name: Stage Windows assets
87+
shell: pwsh
88+
env:
89+
T_TARGET: ""
90+
T_SUFFIX: ""
5291
run: |
53-
curl -L https://github.com/vcsjones/AzureSignTool/releases/download/v6.0.1/AzureSignTool-x64.exe -o AzureSignTool.exe
54-
yarn electron-builder build --config electron-builder.config.cjs --publish never
92+
$ErrorActionPreference = "Stop"
93+
94+
$Version = "${{ steps.version.outputs.version }}"
95+
$Target = "x86_64-pc-windows-msvc"
96+
$OutDir = "release-assets"
97+
New-Item -ItemType Directory -Force -Path $OutDir | Out-Null
98+
99+
Get-ChildItem "src-tauri/target/$Target/release/bundle" -Recurse -File |
100+
Where-Object { $_.Extension -in ".exe", ".msi", ".sig", ".json", ".zip" } |
101+
ForEach-Object { Copy-Item $_.FullName -Destination $OutDir -Force }
102+
103+
$Binary = "src-tauri/target/$Target/release/beaver-notes.exe"
104+
$PortableName = "Beaver Notes-$Version-portable-windows-x64.zip"
105+
Compress-Archive -Path $Binary -DestinationPath (Join-Path $OutDir $PortableName) -Force
55106
56107
- name: Release
57108
uses: softprops/action-gh-release@v2
58109
with:
59110
files: |
60-
dist/*
61-
README.md
62-
package.json
63-
yarn.lock
64-
name: ${{ github.event.inputs.release_name }}
65-
tag_name: ${{ github.run_id }}
111+
release-assets/*
112+
name: Release ${{ github.run_id }}
113+
tag_name: ${{ github.run_id }}-TAURI
66114
body: |
67-
# Signed Release ${{ github.event.inputs.release_name }}
115+
# Signed Release
68116
69-
These are the distributable files for the signed release of Beaver-Notes ${{ github.event.inputs.release_name }}
117+
These are the distributable files for the signed release of Beaver-Notes
70118
71-
The source code was fetched from https://github.com/Beaver-Notes/Beaver-Notes@${{ github.event.inputs.source_branch }}
119+
The source code was fetched from https://github.com/Beaver-Notes/Beaver-Notes@Tauri
72120
73121
122+
123+
124+
125+
# Windows is build
126+
# - id: windows-x64
127+
# runner: windows-latest
128+
# rust_targets: 'x86_64-pc-windows-msvc'
129+
# tauri_target: 'x86_64-pc-windows-msvc'
130+
# bundle_args: '--bundles nsis'
131+
# asset_suffix: 'windows-x64'
132+
133+
# # ARM64 Windows build
134+
# - id: windows-arm64
135+
# runner: windows-11-arm
136+
# rust_targets: 'aarch64-pc-windows-msvc'
137+
# tauri_target: 'aarch64-pc-windows-msvc'
138+
# bundle_args: '--bundles nsis'
139+
# asset_suffix: 'windows-arm64'

0 commit comments

Comments
 (0)