Skip to content

optimizerDuck v2.24.2 - Turkish Support and More Ways to Customize Windows #18

optimizerDuck v2.24.2 - Turkish Support and More Ways to Customize Windows

optimizerDuck v2.24.2 - Turkish Support and More Ways to Customize Windows #18

Workflow file for this run

name: Release
on:
release:
types: [published]
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
jobs:
build:
runs-on: windows-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: 10.0.x
- name: Restore
run: dotnet restore optimizerDuck.slnx
- name: Build
run: dotnet build optimizerDuck.slnx --configuration Release --no-restore
- name: Test
run: dotnet test optimizerDuck.Test/optimizerDuck.Test.csproj --configuration Release --logger "console;verbosity=detailed" --blame-hang --blame-hang-timeout 30s
- name: Publish Single
run: |
dotnet publish optimizerDuck/optimizerDuck.csproj --nologo /p:PublishProfile=Single
shell: pwsh
- name: Get version from tag
id: get_version
run: |
$tag = "${{ github.event.release.tag_name }}"
$version = $tag -replace '^v', ''
echo "version=$version" >> $env:GITHUB_OUTPUT
shell: pwsh
- name: Rename output file
run: |
$version = "${{ steps.get_version.outputs.version }}"
$source = "optimizerDuck/bin/Release/Single/net10.0/publish/win-x64/optimizerDuck.exe"
$dest = "optimizerDuck-Windows-x64-$version.exe"
Move-Item -Path $source -Destination $dest
shell: pwsh
- name: Upload Release Asset
uses: softprops/action-gh-release@v3
with:
files: ./optimizerDuck-Windows-x64-${{ steps.get_version.outputs.version }}.exe
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Wait for asset to be ready
id: verify_asset
shell: pwsh
run: |
$releaseId = "${{ github.event.release.id }}"
$owner = "${{ github.repository_owner }}"
$repo = "optimizerDuck"
$targetAsset = "optimizerDuck-Windows-x64-${{ steps.get_version.outputs.version }}.exe"
$maxRetries = 60
$retryDelay = 2
for ($i = 0; $i -lt $maxRetries; $i++) {
try {
$response = Invoke-RestMethod -Uri "https://api.github.com/repos/$owner/$repo/releases/$releaseId" `
-Headers @{
"Authorization" = "Bearer $env:GITHUB_TOKEN"
"Accept" = "application/vnd.github+json"
}
$asset = $response.assets | Where-Object {
$_.name -eq $targetAsset -and $_.name -like "*.exe"
}
if ($asset) {
Write-Host "::notice::Asset '$targetAsset' found and ready!"
Write-Host "verified=true" >> $env:GITHUB_OUTPUT
exit 0
}
} catch {
Write-Host "API call failed (attempt $($i+1)): $_"
}
Write-Host "Waiting for asset... attempt $($i+1)/$maxRetries"
Start-Sleep -Seconds $retryDelay
}
Write-Host "::error::Asset verification failed after $maxRetries attempts"
exit 1
- name: Send webhook notify
if: steps.verify_asset.outputs.verified == 'true'
shell: pwsh
run: |
$webhookUrl = "https://api.botghost.com/webhook/1124234779194298438/${{ secrets.BOTGHOST_WEBHOOK_RELEASE_EVENT_ID }}"
$body = @{
variables = @(
@{ name = "Release Tag"; variable = "{release_tag}"; value = "${{ github.event.release.tag_name }}" }
@{ name = "Release Owner"; variable = "{release_owner}"; value = "${{ github.repository_owner }}" }
@{ name = "Release Repo"; variable = "{release_repo}"; value = "optimizerDuck" }
)
} | ConvertTo-Json
Write-Host "Sending webhook to BotGhost..."
Invoke-RestMethod -Uri $webhookUrl `
-Method POST `
-Headers @{
"Authorization" = "${{ secrets.BOTGHOST_WEBHOOK_API_KEY }}"
"Content-Type" = "application/json"
} `
-Body $body
Write-Host "::notice::Webhook sent successfully!"