mirror of
https://github.com/Aitum/obs-aitum-multistream.git
synced 2024-11-22 10:22:42 +01:00
6136896cc7
* Update runner to 24.04 as librist is only in 23.10+ * Enable linux build * replace homebrew with linux native packages * Add core depends --------- Co-authored-by: Aaron Honeycutt <aaronhoneycutt@proton.me> Co-authored-by: Exeldro <exelsor@hotmail.com>
297 lines
12 KiB
YAML
297 lines
12 KiB
YAML
name: Build Project
|
|
on:
|
|
workflow_dispatch:
|
|
workflow_call:
|
|
outputs:
|
|
pluginName:
|
|
description: 'Project name detected by parsing build spec file'
|
|
value: ${{ jobs.check-event.outputs.pluginName }}
|
|
jobs:
|
|
check-event:
|
|
name: Check GitHub Event Data 🔎
|
|
runs-on: ubuntu-22.04
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
outputs:
|
|
package: ${{ steps.setup.outputs.package }}
|
|
codesign: ${{ steps.setup.outputs.codesign }}
|
|
notarize: ${{ steps.setup.outputs.notarize }}
|
|
config: ${{ steps.setup.outputs.config }}
|
|
commitHash: ${{ steps.setup.outputs.commitHash }}
|
|
pluginName: ${{ steps.setup.outputs.pluginName }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
- name: Check Event Data ☑️
|
|
id: setup
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|
|
run: |
|
|
: Check Event Data ☑️
|
|
if [[ "${RUNNER_DEBUG}" ]]; then set -x; fi
|
|
|
|
case "${GITHUB_EVENT_NAME}" in
|
|
pull_request)
|
|
config_data=('codesign:false' 'notarize:false' 'package:false' 'config:RelWithDebInfo')
|
|
if gh pr view ${{ github.event.number }} --json labels \
|
|
| jq -e -r '.labels[] | select(.name == "Seeking Testers")' > /dev/null; then
|
|
config_data[0]='codesign:true'
|
|
config_data[2]='package:true'
|
|
fi
|
|
;;
|
|
push)
|
|
config_data=('codesign:true' 'notarize:true' 'package:true' 'config:RelWithDebInfo')
|
|
if [[ ${GITHUB_REF_NAME} =~ [0-9]+.[0-9]+.[0-9]+(-(rc|beta).+)? ]]; then
|
|
config_data[1]='notarize:true'
|
|
config_data[3]='config:Release'
|
|
fi
|
|
;;
|
|
workflow_dispatch)
|
|
config_data=('codesign:true' 'notarize:true' 'package:true' 'config:RelWithDebInfo')
|
|
;;
|
|
schedule)
|
|
config_data=('codesign:true' 'notarize:false' 'package:true' 'config:RelWithDebInfo')
|
|
;;
|
|
*) ;;
|
|
esac
|
|
|
|
for config in "${config_data[@]}"; do
|
|
IFS=':' read -r key value <<< "${config}"
|
|
echo "${key}=${value}" >> $GITHUB_OUTPUT
|
|
done
|
|
echo "commitHash=${GITHUB_SHA:0:9}" >> $GITHUB_OUTPUT
|
|
|
|
plugin_name="$(grep 'name' buildspec.json | sed -E -e 's/^.+"name":[^"]+"(.+)",?$/\1/g')"
|
|
plugin_display_name="$(grep 'displayName' buildspec.json | sed -E -e 's/^.+"displayName":[^"]+"(.+)",?$/\1/g' || echo "")"
|
|
|
|
if [[ "${plugin_display_name}" ]]; then
|
|
echo "pluginName=${plugin_display_name}" >> $GITHUB_OUTPUT
|
|
else
|
|
echo "pluginName=${plugin_name}" >> $GITHUB_OUTPUT
|
|
fi
|
|
|
|
macos-build:
|
|
name: Build for macOS 🍏
|
|
runs-on: macos-14
|
|
needs: check-event
|
|
defaults:
|
|
run:
|
|
shell: zsh --no-rcs --errexit --pipefail {0}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
submodules: recursive
|
|
fetch-depth: 0
|
|
|
|
- name: Set Up Environment 🔧
|
|
id: setup
|
|
run: |
|
|
: Set Up Environment 🔧
|
|
if (( ${+RUNNER_DEBUG} )) setopt XTRACE
|
|
|
|
print '::group::Enable Xcode 15.2'
|
|
sudo xcode-select --switch /Applications/Xcode_15.2.app/Contents/Developer
|
|
print '::endgroup::'
|
|
|
|
print '::group::Clean Homebrew Environment'
|
|
local -a to_remove=()
|
|
|
|
if (( #to_remove )) brew uninstall --ignore-dependencies ${to_remove}
|
|
print '::endgroup::'
|
|
|
|
local product_name
|
|
local product_version
|
|
read -r product_name product_version <<< \
|
|
"$(jq -r '. | {name, version} | join(" ")' buildspec.json)"
|
|
|
|
print "pluginName=${product_name}" >> $GITHUB_OUTPUT
|
|
print "pluginVersion=${product_version}" >> $GITHUB_OUTPUT
|
|
|
|
- uses: actions/cache@v4
|
|
id: ccache-cache
|
|
with:
|
|
path: ${{ github.workspace }}/.ccache
|
|
key: ${{ runner.os }}-ccache-${{ needs.check-event.outputs.config }}
|
|
restore-keys: |
|
|
${{ runner.os }}-ccache-
|
|
|
|
- name: Set Up Codesigning 🔑
|
|
uses: ./.github/actions/setup-macos-codesigning
|
|
if: fromJSON(needs.check-event.outputs.codesign)
|
|
id: codesign
|
|
with:
|
|
codesignIdentity: ${{ secrets.APPLE_CODESIGN_IDENTITY }}
|
|
installerIdentity: ${{ secrets.APPLE_CODESIGN_INSTALLER_IDENTITY }}
|
|
codesignCertificate: ${{ secrets.APPLE_CSC_MULTI }}
|
|
certificatePassword: ${{ secrets.APPLE_CSC_MULTI_PASSWORD }}
|
|
keychainPassword: ${{ secrets.MACOS_KEYCHAIN_PASSWORD }}
|
|
provisioningProfile: ${{ secrets.MACOS_SIGNING_PROVISIONING_PROFILE }}
|
|
notarizationUser: ${{ secrets.APPLE_EMAIL }}
|
|
notarizationPassword: ${{ secrets.APPLE_PASSWORD }}
|
|
|
|
- name: Build Plugin 🧱
|
|
uses: ./.github/actions/build-plugin
|
|
with:
|
|
target: macos-universal
|
|
config: ${{ needs.check-event.outputs.config }}
|
|
codesign: ${{ fromJSON(needs.check-event.outputs.codesign) }}
|
|
codesignIdent: ${{ steps.codesign.outputs.codesignIdent }}
|
|
|
|
- name: Package Plugin 📀
|
|
uses: ./.github/actions/package-plugin
|
|
with:
|
|
target: macos-universal
|
|
config: ${{ needs.check-event.outputs.config }}
|
|
package: ${{ fromJSON(needs.check-event.outputs.package) }}
|
|
codesign: ${{ fromJSON(needs.check-event.outputs.codesign) && fromJSON(steps.codesign.outputs.haveCodesignIdent) }}
|
|
codesignIdent: ${{ steps.codesign.outputs.codesignIdent }}
|
|
installerIdent: ${{ steps.codesign.outputs.installerIdent }}
|
|
codesignTeam: ${{ steps.codesign.outputs.codesignTeam }}
|
|
notarize: ${{ fromJSON(needs.check-event.outputs.notarize) && fromJSON(steps.codesign.outputs.haveNotarizationUser) }}
|
|
codesignUser: ${{ secrets.APPLE_EMAIL }}
|
|
codesignPass: ${{ secrets.APPLE_PASSWORD }}
|
|
|
|
- name: Upload Artifacts 📡
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: ${{ steps.setup.outputs.pluginName }}-${{ steps.setup.outputs.pluginVersion }}-macos-universal-${{ needs.check-event.outputs.commitHash }}
|
|
path: ${{ github.workspace }}/release/${{ steps.setup.outputs.pluginName }}-${{ steps.setup.outputs.pluginVersion }}-macos-universal.*
|
|
|
|
- name: Upload Debug Symbol Artifacts 🪲
|
|
uses: actions/upload-artifact@v4
|
|
if: ${{ needs.check-event.outputs.config == 'Release' }}
|
|
with:
|
|
name: ${{ steps.setup.outputs.pluginName }}-${{ steps.setup.outputs.pluginVersion }}-macos-universal-${{ needs.check-event.outputs.commitHash }}-dSYMs
|
|
path: ${{ github.workspace }}/release/${{ steps.setup.outputs.pluginName }}-${{ steps.setup.outputs.pluginVersion }}-macos-universal-dSYMs.*
|
|
|
|
ubuntu-build:
|
|
name: Build for Ubuntu 🐧
|
|
runs-on: ubuntu-24.04
|
|
needs: check-event
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
submodules: recursive
|
|
fetch-depth: 0
|
|
|
|
- name: Set Up Environment 🔧
|
|
id: setup
|
|
run: |
|
|
: Set Up Environment 🔧
|
|
if [[ "${RUNNER_DEBUG}" ]]; then set -x; fi
|
|
|
|
read -r product_name product_version <<< \
|
|
"$(jq -r '. | {name, version} | join(" ")' buildspec.json)"
|
|
|
|
echo "pluginName=${product_name}" >> $GITHUB_OUTPUT
|
|
echo "pluginVersion=${product_version}" >> $GITHUB_OUTPUT
|
|
|
|
- uses: actions/cache@v4
|
|
id: ccache-cache
|
|
with:
|
|
path: ${{ github.workspace }}/.ccache
|
|
key: ${{ runner.os }}-ccache-x86_64-${{ needs.check-event.outputs.config }}
|
|
restore-keys: |
|
|
${{ runner.os }}-ccache-x86_64-
|
|
|
|
- name: Build Plugin 🧱
|
|
uses: ./.github/actions/build-plugin
|
|
with:
|
|
target: x86_64
|
|
config: ${{ needs.check-event.outputs.config }}
|
|
|
|
- name: Package Plugin 📀
|
|
uses: ./.github/actions/package-plugin
|
|
with:
|
|
package: ${{ fromJSON(needs.check-event.outputs.package) }}
|
|
target: x86_64
|
|
config: ${{ needs.check-event.outputs.config }}
|
|
|
|
- name: Upload Source Tarball 🗜️
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: ${{ steps.setup.outputs.pluginName }}-${{ steps.setup.outputs.pluginVersion }}-sources-${{ needs.check-event.outputs.commitHash }}
|
|
path: ${{ github.workspace }}/release/${{ steps.setup.outputs.pluginName }}-${{ steps.setup.outputs.pluginVersion }}-source.*
|
|
|
|
- name: Upload Artifacts 📡
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: ${{ steps.setup.outputs.pluginName }}-${{ steps.setup.outputs.pluginVersion }}-ubuntu-22.04-x86_64-${{ needs.check-event.outputs.commitHash }}
|
|
path: ${{ github.workspace }}/release/${{ steps.setup.outputs.pluginName }}-${{ steps.setup.outputs.pluginVersion }}-x86_64*.*
|
|
|
|
- name: Upload debug symbol artifacts 🪲
|
|
uses: actions/upload-artifact@v4
|
|
if: ${{ fromJSON(needs.check-event.outputs.package) }}
|
|
with:
|
|
name: ${{ steps.setup.outputs.pluginName }}-${{ steps.setup.outputs.pluginVersion }}-ubuntu-22.04-x86_64-${{ needs.check-event.outputs.commitHash }}-dbgsym
|
|
path: ${{ github.workspace }}/release/${{ steps.setup.outputs.pluginName }}-${{ steps.setup.outputs.pluginVersion }}-x86_64*-dbgsym.ddeb
|
|
|
|
windows-build:
|
|
name: Build for Windows 🪟
|
|
runs-on: windows-2022
|
|
needs: check-event
|
|
defaults:
|
|
run:
|
|
shell: pwsh
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
submodules: recursive
|
|
fetch-depth: 0
|
|
|
|
- name: Set Up Environment 🔧
|
|
id: setup
|
|
run: |
|
|
# Set Up Environment 🔧
|
|
if ( $Env:RUNNER_DEBUG -ne $null ) {
|
|
Set-PSDebug -Trace 1
|
|
}
|
|
|
|
$BuildSpec = Get-Content -Path buildspec.json -Raw | ConvertFrom-Json
|
|
$ProductName = $BuildSpec.name
|
|
$ProductVersion = $BuildSpec.version
|
|
|
|
"pluginName=${ProductName}" >> $env:GITHUB_OUTPUT
|
|
"pluginVersion=${ProductVersion}" >> $env:GITHUB_OUTPUT
|
|
|
|
- name: Build Plugin 🧱
|
|
uses: ./.github/actions/build-plugin
|
|
with:
|
|
target: x64
|
|
config: ${{ needs.check-event.outputs.config }}
|
|
|
|
- name: Create Code Signing Certificate
|
|
if: success() && github.event_name != 'pull_request'
|
|
run: |
|
|
New-Item -ItemType directory -Path certificate
|
|
Set-Content -Path certificate\certificate.txt -Value '${{ secrets.WINDOWS_CSC_LINK }}'
|
|
certutil -decode certificate\certificate.txt certificate\certificate.pfx
|
|
|
|
- name: Code Sign 64
|
|
if: success() && github.event_name != 'pull_request'
|
|
run: |
|
|
& 'C:/Program Files (x86)/Windows Kits/10/bin/10.0.20348.0/x64/signtool.exe' sign /f certificate\certificate.pfx /p '${{ secrets.WINDOWS_CSC_PASS }}' /t http://timestamp.comodoca.com/authenticode .\release\${{ needs.check-event.outputs.config }}\obs-plugins\64bit\${{ steps.setup.outputs.pluginName }}.dll
|
|
|
|
- name: Package Plugin 📀
|
|
uses: ./.github/actions/package-plugin
|
|
with:
|
|
target: x64
|
|
config: ${{ needs.check-event.outputs.config }}
|
|
package: ${{ fromJSON(needs.check-event.outputs.package) }}
|
|
|
|
- name: Code Sign Installer
|
|
if: success() && github.event_name != 'pull_request'
|
|
run: |
|
|
& 'C:/Program Files (x86)/Windows Kits/10/bin/10.0.20348.0/x64/signtool.exe' sign /f certificate\certificate.pfx /p '${{ secrets.WINDOWS_CSC_PASS }}' /t http://timestamp.comodoca.com/authenticode ./release/${{ steps.setup.outputs.pluginName }}-${{ steps.setup.outputs.pluginVersion }}-windows-x64-Installer.exe
|
|
|
|
- name: Upload Artifacts 📡
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: ${{ steps.setup.outputs.pluginName }}-${{ steps.setup.outputs.pluginVersion }}-windows-x64-${{ needs.check-event.outputs.commitHash }}
|
|
path: ${{ github.workspace }}/release/${{ steps.setup.outputs.pluginName }}-${{ steps.setup.outputs.pluginVersion }}-windows-x64*.*
|