Macrame/.github/workflows/windows-release.yml

70 lines
2 KiB
YAML

name: Release Build (Windows)
on:
push:
branches:
- "release/**"
permissions:
contents: write
jobs:
windows-release-build:
runs-on: windows-latest
steps:
- name: Checkout the release branch
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Extract version from branch name
id: extract
shell: bash
run: |
version="${GITHUB_REF##*/}"
echo "version=$version" >> $GITHUB_OUTPUT
- name: Set up Git
shell: bash
run: |
git config user.name "github-actions"
git config user.email "github-actions@github.com"
- name: Run build script
shell: cmd
run: .\build-scripts\windows-build.bat
- name: Cleanup root directory
shell: pwsh
run: |
$folders = @("app", "ui", "build-scripts")
foreach ($folder in $folders) {
if (Test-Path $folder) {
Remove-Item -Recurse -Force -Path $folder
Write-Output "Removed development folder: $folder"
} else {
Write-Output "$folder does not exist"
}
}
# Delete all files except: Macrame.exe, favicon.ico, README.md
Get-ChildItem -File | Where-Object { $_.Name -notin @("Macrame.exe", "favicon.ico", "README.md") } | ForEach-Object {
Write-Output "Deleting file: $($_.Name)"
Remove-Item -Force $_.FullName
}
- name: Commit and push build artifacts
shell: bash
run: |
git add -A
git commit -m "Automated release build for version: ${{ steps.extract.outputs.version }}"
git push origin ${{ github.ref }}
- name: Fetch and force merge into main
shell: bash
run: |
git fetch origin main
git checkout main
git merge -X theirs ${{ github.ref }} -m "Merging release version ${{ steps.extract.outputs.version }} into main"
git push origin main