build windows release asset #15
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: build windows release asset | |
| "on": | |
| workflow_dispatch: | |
| inputs: | |
| tag: | |
| description: "release tag (example: v1.0.0)" | |
| required: true | |
| default: "v1.0.0" | |
| jobs: | |
| windows: | |
| runs-on: windows-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: checkout | |
| uses: actions/checkout@v4 | |
| - name: setup cmake | |
| uses: lukka/get-cmake@v3.31.6 | |
| - name: clone openfx | |
| shell: pwsh | |
| run: | | |
| if (!(Test-Path -Path openfx)) { | |
| git clone --depth 1 https://github.com/AcademySoftwareFoundation/openfx.git openfx | |
| } | |
| - name: configure | |
| shell: pwsh | |
| run: | | |
| $root = $env:GITHUB_WORKSPACE | |
| cmake -S "$root" -B "$root/build" -DCMAKE_BUILD_TYPE=Release -DOPENFX_ROOT="$root/openfx" | |
| - name: build | |
| shell: pwsh | |
| run: | | |
| $root = $env:GITHUB_WORKSPACE | |
| cmake --build "$root/build" --config Release | |
| - name: package | |
| shell: pwsh | |
| run: | | |
| $root = $env:GITHUB_WORKSPACE | |
| $tag = "${{ inputs.tag }}" | |
| $version = $tag.TrimStart('v') | |
| if (Test-Path "$root/dist") { Remove-Item -Recurse -Force "$root/dist" } | |
| New-Item -ItemType Directory -Path "$root/dist" | Out-Null | |
| Copy-Item -Recurse -Force "$root/Boilify.ofx.bundle" "$root/dist/Boilify.ofx.bundle" | |
| # Ensure bundle structure matches OpenFX packaging recommendations. | |
| if (Test-Path "$root/dist/Boilify.ofx.bundle/Linux-x86-64") { Remove-Item -Recurse -Force "$root/dist/Boilify.ofx.bundle/Linux-x86-64" } | |
| if (Test-Path "$root/dist/Boilify.ofx.bundle/Win64") { Remove-Item -Recurse -Force "$root/dist/Boilify.ofx.bundle/Win64" } | |
| if (Test-Path "$root/dist/Boilify.ofx.bundle/MacOS") { Remove-Item -Recurse -Force "$root/dist/Boilify.ofx.bundle/MacOS" } | |
| if (Test-Path "$root/dist/Boilify.ofx.bundle/Contents/MacOS") { Remove-Item -Recurse -Force "$root/dist/Boilify.ofx.bundle/Contents/MacOS" } | |
| if (Test-Path "$root/dist/Boilify.ofx.bundle/Contents/Linux-x86-64") { Remove-Item -Recurse -Force "$root/dist/Boilify.ofx.bundle/Contents/Linux-x86-64" } | |
| New-Item -ItemType Directory -Force -Path "$root/dist/Boilify.ofx.bundle/Contents/Win64" | Out-Null | |
| Copy-Item -Force "$root/build/Win64/Boilify.ofx" "$root/dist/Boilify.ofx.bundle/Contents/Win64/Boilify.ofx" | |
| Copy-Item -Force "$root/README.md" "$root/dist/README.md" | |
| Copy-Item -Force "$root/LICENSE" "$root/dist/LICENSE" | |
| Copy-Item -Force "$root/install.bat" "$root/dist/install.bat" | |
| $zip = "$root/dist/boilify-v$version-windows.zip" | |
| if (Test-Path $zip) { Remove-Item -Force $zip } | |
| Compress-Archive -Path "$root/dist/Boilify.ofx.bundle","$root/dist/README.md","$root/dist/LICENSE","$root/dist/install.bat" -DestinationPath $zip | |
| echo "zip_path=$zip" | Out-File -FilePath $env:GITHUB_OUTPUT -Append | |
| - name: upload to github release | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| shell: pwsh | |
| run: | | |
| $tag = "${{ inputs.tag }}" | |
| $zip = (Get-ChildItem dist -Filter "boilify-*-windows.zip" | Select-Object -First 1).FullName | |
| gh release upload $tag $zip --clobber |