Skip to content

release

release #25

Workflow file for this run

name: release
on:
push:
tags:
- 'v*'
workflow_dispatch:
permissions:
contents: write
jobs:
release:
name: Build and package Windows component
runs-on: windows-2025-vs2026
steps:
- name: Checkout
uses: actions/checkout@v7
with:
fetch-depth: 0
submodules: recursive
- name: Add MSBuild to PATH
uses: microsoft/setup-msbuild@v3
with:
vs-version: '[18.0,19.0)'
msbuild-architecture: x64
- name: Configure vcpkg cache
uses: lukka/run-vcpkg@v11.6
with:
vcpkgDirectory: '${{ github.workspace }}/vcpkg'
- name: Install Win32 dependencies
shell: pwsh
run: .\scripts\install-dependencies.ps1 -Triplet x86-mpv
- name: Install x64 dependencies
shell: pwsh
run: .\scripts\install-dependencies.ps1 -Triplet x64-mpv
- name: Set release version
shell: pwsh
run: |
$version = $env:GITHUB_REF_NAME -replace '^v', '' -replace '-', ' '
$versionDefinition = '#define VERSION_NO "{0}"' -f $version
(Get-Content .\src\main.cpp) `
-replace '#define VERSION_NO.*$', $versionDefinition |
Set-Content .\src\main.cpp
- name: Build Win32 Release
run: >-
msbuild .\src\foo_mpv.sln /m /t:Build
/p:Configuration=Release /p:Platform=Win32 /v:minimal
- name: Build x64 Release
run: >-
msbuild .\src\foo_mpv.sln /m /t:Build
/p:Configuration=Release /p:Platform=x64 /v:minimal
- name: Download Win32 libmpv
shell: pwsh
run: >-
.\scripts\download-libmpv.ps1 -Architecture i686
-Destination .\artifacts\runtime\Win32\mpv-2.dll
- name: Download x64 libmpv
shell: pwsh
run: >-
.\scripts\download-libmpv.ps1 -Architecture x86_64
-Destination .\artifacts\runtime\x64\mpv-2.dll
- name: Package component
shell: pwsh
run: |
.\scripts\package-component.ps1 `
-Win32Dll .\src\build\Win32\Release\foo_mpv\foo_mpv.dll `
-X64Dll .\src\build\x64\Release\foo_mpv\foo_mpv.dll `
-Win32Libmpv .\artifacts\runtime\Win32\mpv-2.dll `
-X64Libmpv .\artifacts\runtime\x64\mpv-2.dll
7z l .\artifacts\foo_mpv.fb2k-component
- name: Upload workflow artifacts
uses: actions/upload-artifact@v7
with:
name: foo_mpv-release
if-no-files-found: error
path: |
artifacts/foo_mpv.fb2k-component
artifacts/foo_mpv-symbols.zip
- name: Create draft release
if: github.ref_type == 'tag'
shell: pwsh
env:
GH_TOKEN: ${{ github.token }}
run: |
$assets = @(
'.\artifacts\foo_mpv.fb2k-component',
'.\artifacts\foo_mpv-symbols.zip'
)
gh release view $env:GITHUB_REF_NAME *> $null
if ($LASTEXITCODE -eq 0) {
gh release upload $env:GITHUB_REF_NAME @assets --clobber
} else {
gh release create $env:GITHUB_REF_NAME @assets `
--draft --title $env:GITHUB_REF_NAME --notes 'Automated release'
}