d
This commit is contained in:
1 parent
32e258dee7
commit
d7a56b19d4
6 files changed
+69
-60
No files matched your search
@@ -0,0 +1,158 @@
|
||||
name: Build Windows Release
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- main
|
||||
tags:
|
||||
- "*"
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
- main
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
publish_release:
|
||||
description: "Publish the installers to a Gitea release"
|
||||
required: true
|
||||
default: true
|
||||
type: boolean
|
||||
release_tag:
|
||||
description: "Release tag to create or update when publishing manually, for example v0.1.0"
|
||||
required: false
|
||||
default: "v0.1.0"
|
||||
type: string
|
||||
|
||||
permissions:
|
||||
code: read
|
||||
releases: write
|
||||
|
||||
concurrency:
|
||||
group: build-windows-release-${{ gitea.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
tests:
|
||||
name: Rust tests
|
||||
# Register a Windows Gitea runner with the label windows:host.
|
||||
runs-on: windows
|
||||
|
||||
defaults:
|
||||
run:
|
||||
shell: pwsh
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: https://gitea.com/actions/checkout@v4
|
||||
|
||||
- name: Set up Rust
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
|
||||
- name: Cache Rust dependencies
|
||||
uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
workspaces: |
|
||||
.
|
||||
src-tauri
|
||||
|
||||
- name: Run Rust tests
|
||||
run: cargo test
|
||||
|
||||
windows-installer:
|
||||
name: Windows installer
|
||||
runs-on: windows
|
||||
|
||||
defaults:
|
||||
run:
|
||||
shell: pwsh
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: https://gitea.com/actions/checkout@v4
|
||||
|
||||
- name: Set up pnpm
|
||||
uses: pnpm/action-setup@v4
|
||||
with:
|
||||
version: 11.19.0
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22
|
||||
cache: pnpm
|
||||
|
||||
- name: Set up Rust
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
|
||||
- name: Cache Rust dependencies
|
||||
uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
workspaces: |
|
||||
.
|
||||
src-tauri
|
||||
|
||||
- name: Check Windows bundler dependencies
|
||||
run: |
|
||||
$nsis = "C:\Program Files (x86)\NSIS"
|
||||
$wix = @(
|
||||
"C:\Program Files (x86)\WiX Toolset v3.14\bin",
|
||||
"C:\Program Files (x86)\WiX Toolset v3.11\bin"
|
||||
) | Where-Object { Test-Path $_ } | Select-Object -First 1
|
||||
if (-not (Test-Path "$nsis\makensis.exe")) {
|
||||
throw "NSIS is missing. Install it on the Windows runner before starting the runner."
|
||||
}
|
||||
if (-not $wix) {
|
||||
throw "WiX Toolset 3 is missing. Install it on the Windows runner before starting the runner."
|
||||
}
|
||||
Add-Content $env:GITEA_PATH $nsis
|
||||
Add-Content $env:GITEA_PATH $wix
|
||||
|
||||
- name: Install frontend dependencies
|
||||
run: pnpm install --frozen-lockfile
|
||||
|
||||
- name: Build Windows desktop installers
|
||||
run: pnpm run desktop:build
|
||||
|
||||
- name: Resolve release publishing
|
||||
id: release
|
||||
env:
|
||||
DISPATCH_PUBLISH_RELEASE: ${{ inputs.publish_release }}
|
||||
DISPATCH_RELEASE_TAG: ${{ inputs.release_tag }}
|
||||
run: |
|
||||
$publish = "false"
|
||||
$tag = ""
|
||||
|
||||
if ($env:GITEA_REF -like "refs/tags/*") {
|
||||
$publish = "true"
|
||||
$tag = $env:GITEA_REF_NAME
|
||||
} elseif ($env:GITEA_EVENT_NAME -eq "workflow_dispatch" -and $env:DISPATCH_PUBLISH_RELEASE -eq "true") {
|
||||
$publish = "true"
|
||||
$tag = $env:DISPATCH_RELEASE_TAG.Trim()
|
||||
if ([string]::IsNullOrWhiteSpace($tag)) {
|
||||
throw "release_tag is required when publish_release is true."
|
||||
}
|
||||
}
|
||||
|
||||
"publish=$publish" >> $env:GITEA_OUTPUT
|
||||
"tag=$tag" >> $env:GITEA_OUTPUT
|
||||
|
||||
- name: Upload installer artifacts
|
||||
uses: https://gitea.com/actions/upload-artifact@v4
|
||||
with:
|
||||
name: clipforge-windows-installers
|
||||
if-no-files-found: error
|
||||
path: |
|
||||
src-tauri/target/release/bundle/msi/*.msi
|
||||
src-tauri/target/release/bundle/nsis/*.exe
|
||||
|
||||
- name: Publish Gitea release assets
|
||||
if: steps.release.outputs.publish == 'true'
|
||||
uses: https://gitea.com/actions/gitea-release-action@v1
|
||||
with:
|
||||
server_url: ${{ gitea.server_url }}
|
||||
token: ${{ secrets.GITEA_TOKEN }}
|
||||
tag_name: ${{ steps.release.outputs.tag }}
|
||||
files: |
|
||||
src-tauri/target/release/bundle/msi/*.msi
|
||||
src-tauri/target/release/bundle/nsis/*.exe
|
||||
Reference in new issue
Block a user