Files
overlord/.github/workflows/desktop-release.yml
T
2026-05-11 20:04:13 -05:00

101 lines
3.1 KiB
YAML

name: Overlord Desktop Windows Release
on:
push:
branches: ["main"]
paths:
- "Overlord-Desktop/**"
jobs:
build:
runs-on: windows-latest
permissions:
contents: write
defaults:
run:
working-directory: Overlord-Desktop
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache Rust build
uses: Swatinem/rust-cache@v2
with:
workspaces: Overlord-Desktop/src-tauri -> target
- name: Install Dependencies
run: bun install
- name: Vendor frontend assets
run: bun run vendor
- name: Get Version
run: |
$version = (Get-Content package.json | ConvertFrom-Json).version
echo "VERSION=$version" >> $env:GITHUB_ENV
shell: pwsh
- name: Build Windows Installer (Tauri NSIS)
run: bun run build:win
- name: Locate NSIS Installer
id: locate
shell: pwsh
run: |
$nsis = Get-ChildItem -Path src-tauri\target\release\bundle\nsis\*.exe -ErrorAction Stop | Select-Object -First 1
echo "INSTALLER=$($nsis.FullName)" >> $env:GITHUB_ENV
echo "INSTALLER_NAME=$($nsis.Name)" >> $env:GITHUB_ENV
- name: Upload Build Artifact
uses: actions/upload-artifact@v4
with:
name: overlord-desktop-${{ env.VERSION }}
path: ${{ env.INSTALLER }}
- name: Delete Existing Release and Tag
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Look up the release by tag_name via the list endpoint (works even if the git tag is gone)
RELEASE_ID=$(gh api /repos/${{ github.repository }}/releases \
--jq '.[] | select(.tag_name == "Overlord-Desktop-v${{ env.VERSION }}") | .id' \
2>/dev/null || true)
if [ -n "$RELEASE_ID" ]; then
gh api --method DELETE /repos/${{ github.repository }}/releases/$RELEASE_ID || true
fi
# Delete the git tag ref if it somehow still exists
gh api --method DELETE /repos/${{ github.repository }}/git/refs/tags/Overlord-Desktop-v${{ env.VERSION }} 2>/dev/null || true
shell: bash
- name: Create and Push Tag
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag -f Overlord-Desktop-v${{ env.VERSION }}
git push origin Overlord-Desktop-v${{ env.VERSION }} --force
shell: bash
- name: Create Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create Overlord-Desktop-v${{ env.VERSION }} "${{ env.INSTALLER }}" "PLEASE_READ.txt" \
--verify-tag \
-t "Overlord Desktop v${{ env.VERSION }}" \
-n "Automated build release for Overlord Desktop v${{ env.VERSION }}" \
--draft=false \
--prerelease=false
shell: bash