Files
overlord/.github/workflows/desktop-release.yml
T
2026-03-22 13:45:55 -05:00

74 lines
2.3 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 Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Install Dependencies
run: npm install
- name: Get Version
run: |
$version = (Get-Content package.json | ConvertFrom-Json).version
echo "VERSION=$version" >> $env:GITHUB_ENV
shell: pwsh
- name: Build Windows Installer
run: npm run build:win
- name: Upload Build Artifact
uses: actions/upload-artifact@v4
with:
name: overlord-desktop-${{ env.VERSION }}
path: Overlord-Desktop/dist/Overlord Setup.exe
- name: Delete Existing Release and Tag
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Find and delete any release with this tag_name, even if the git tag no longer exists.
# gh release delete requires the tag ref to exist, so we use the API directly instead.
RELEASE_ID=$(gh api /repos/${{ github.repository }}/releases \
--jq '.[] | select(.tag_name == "Overlord-Desktop-v${{ env.VERSION }}") | .id' \
2>/dev/null | head -1)
if [ -n "$RELEASE_ID" ]; then
gh api --method DELETE /repos/${{ github.repository }}/releases/$RELEASE_ID || true
fi
# Also 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 }} || true
shell: bash
- name: Create Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create Overlord-Desktop-v${{ env.VERSION }} "dist/Overlord Setup.exe" "PLEASE_READ.txt" \
-t "Overlord Desktop v${{ env.VERSION }}" \
-n "Automated build release for Overlord Desktop v${{ env.VERSION }}" \
--draft=false \
--prerelease=false
shell: bash