Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
156 changes: 156 additions & 0 deletions .github/workflows/ossign-release-tauri.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
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: Tauri
fetch-depth: 1

- 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

- name: Build Windows bundles
shell: bash
env:
CI: 'true'
OSSIGN_CONFIG_BASE64: ${{ secrets.OSSIGN_CONFIG_BASE64 }}
run: |
yarn tauri build --verbose --target "${{ matrix.tauri_target }}" --bundles nsis --ci || true

- 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 }}

73 changes: 0 additions & 73 deletions .github/workflows/ossign-release.yml

This file was deleted.