diff --git a/.github/workflows/steam.yml b/.github/workflows/steam.yml index a46bac6d8..70ee72d4f 100644 --- a/.github/workflows/steam.yml +++ b/.github/workflows/steam.yml @@ -15,6 +15,9 @@ on: mac_url_override: description: 'Mac build to use (.dmg only)' required: false + mac_arm_url_override: + description: 'Mac ARM build to use (.dmg only)' + required: false schedule: - cron: 0 0 * * * @@ -79,7 +82,8 @@ jobs: ASSETS="$(curl -s "${ASSETS_URL}")" WIN_ASSET_URL="$(jq -r '.[] | select(.name|test(".*x64.zip")) .browser_download_url' <<< ${ASSETS})" - MAC_ASSET_URL="$(jq -r '.[] | select(.name|test(".*.dmg")) .browser_download_url' <<< ${ASSETS})" + MAC_ASSET_URL="$(jq -r '.[] | select(.name|test(".*x86_64.*.dmg")) .browser_download_url' <<< ${ASSETS})" + MAC_ARM_ASSET_URL="$(jq -r '.[] | select(.name|test(".*arm64.*.dmg")) .browser_download_url' <<< ${ASSETS})" TYPE='release' else BRANCH='${{ env.STEAM_NIGHTLY_BRANCH }}' @@ -88,8 +92,9 @@ jobs: DESC="g$(jq -r '.workflow_runs[].head_sha' <<< "${BUILDS}" | cut -c1-9)" ARTIFACTS="$(curl -s ${ARTIFACTS_URL})" - WIN_ASSET_URL="$(jq -r '.artifacts[] | select(.name|test(".*win-x64.*")) .archive_download_url' <<< ${ARTIFACTS})" + WIN_ASSET_URL="$(jq -r '.artifacts[] | select(.name|test(".*windows-x64.*")) .archive_download_url' <<< ${ARTIFACTS})" MAC_ASSET_URL="$(jq -r '.artifacts[] | select(.name|test(".*macos-x86_64.*")) .archive_download_url' <<< ${ARTIFACTS})" + MAC_ARM_ASSET_URL="$(jq -r '.artifacts[] | select(.name|test(".*macos-arm64.*")) .archive_download_url' <<< ${ARTIFACTS})" TYPE='nightly' fi @@ -102,9 +107,13 @@ jobs: if [[ -n '${{ github.event.inputs.mac_url_override }}' ]]; then MAC_ASSET_URL='${{ github.event.inputs.mac_url_override }}' fi + + if [[ -n '${{ github.event.inputs.mac_arm_url_override }}' ]]; then + MAC_ARM_ASSET_URL='${{ github.event.inputs.mac_arm_url_override }}' + fi fi - if [[ -z ${WIN_ASSET_URL} || -z ${MAC_ASSET_URL} ]]; then + if [[ -z ${WIN_ASSET_URL} || -z ${MAC_ASSET_URL} || -z ${MAC_ARM_ASSET_URL} ]]; then echo "Missing at least one asset URL!" exit 1 fi @@ -115,6 +124,7 @@ jobs: echo "::set-output name=desc::${DESC}" echo "::set-output name=win_url::${WIN_ASSET_URL}" echo "::set-output name=mac_intel_url::${MAC_ASSET_URL}" + echo "::set-output name=mac_arm_url::${MAC_ARM_ASSET_URL}" - name: Restore build cache id: cache @@ -150,12 +160,18 @@ jobs: fi echo "::endgroup::" - echo "::group::Download Mac build" + echo "::group::Download Mac builds" if [[ '${{ steps.build-info.outputs.mac_intel_url }}' == *'api.github.com'* ]]; then curl -L -H 'Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' '${{ steps.build-info.outputs.mac_intel_url }}' -o mac_x86.dmg.zip else curl -L '${{ steps.build-info.outputs.mac_intel_url }}' -o mac_x86.dmg fi + + if [[ '${{ steps.build-info.outputs.mac_arm_url }}' == *'api.github.com'* ]]; then + curl -L -H 'Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' '${{ steps.build-info.outputs.mac_arm_url }}' -o mac_arm64.dmg.zip + else + curl -L '${{ steps.build-info.outputs.mac_arm_url }}' -o mac_arm64.dmg + fi echo "::endgroup::" mkdir -p steam && cd steam @@ -171,24 +187,41 @@ jobs: rm *.zip fi # copy install scripts and create sentinel file - cp -r ../../source/CI/steam/scripts scripts + cp -r ../../source/CI/steam/scripts_windows scripts touch disable_updater ) echo "::endgroup::" echo "::group::Extract macOS (x86)" + mkdir -p steam-macos/x86 mkdir steam-macos # CI builds are zipped if [[ -f ../mac_x86.dmg.zip ]]; then unzip ../mac_x86.dmg.zip # 7-Zip will have an exit code of 2 due to the "unsafe" 'Applications' symlink. # GitHub treats this as a failure so ignore non-zero exit codes here. - 7zzs x *.dmg -otmp || true + 7zz x *.dmg -otmp_x86 || true + rm *.dmg else - 7zzs x ../mac_x86.dmg -otmp || true + 7zz x ../mac_x86.dmg -otmp_x86 || true fi - mv tmp/*/OBS.app steam-macos + mv tmp_x86/*/OBS.app steam-macos/x86 + echo "::endgroup::" + + echo "::group::Extract and prepare macOS (arm64)" + mkdir -p steam-macos/arm64 + if [[ -f ../mac_arm64.dmg.zip ]]; then + unzip ../mac_arm64.dmg.zip + 7zz x *.dmg -otmp_arm64 || true + rm *.dmg + else + 7zz x ../mac_arm64.dmg -otmp_arm64 || true + fi + + mv tmp_arm64/*/OBS.app steam-macos/arm64 + + cp ../source/CI/steam/scripts_macos/launch.sh steam-macos/launch.sh echo "::endgroup::" - name: Setup steamcmd diff --git a/CI/steam/scripts_macos/launch.sh b/CI/steam/scripts_macos/launch.sh new file mode 100644 index 000000000..b04a76623 --- /dev/null +++ b/CI/steam/scripts_macos/launch.sh @@ -0,0 +1,16 @@ +#!/bin/zsh + +arch_name="$(uname -m)" + +# legacy app installation +if [ -d OBS.app ]; then + exec open OBS.app -W --args "$@" +fi + +if [ "${arch_name}" = "x86_64" ]; then + exec open x86/OBS.app -W --args "$@" +elif [ "${arch_name}" = "arm64" ]; then + exec open arm64/OBS.app -W --args "$@" +else + echo "Unknown architecture: ${arch_name}" +fi diff --git a/CI/steam/scripts/install.bat b/CI/steam/scripts_windows/install.bat similarity index 100% rename from CI/steam/scripts/install.bat rename to CI/steam/scripts_windows/install.bat diff --git a/CI/steam/scripts/installscript.vdf b/CI/steam/scripts_windows/installscript.vdf similarity index 100% rename from CI/steam/scripts/installscript.vdf rename to CI/steam/scripts_windows/installscript.vdf diff --git a/CI/steam/scripts/uninstall.bat b/CI/steam/scripts_windows/uninstall.bat similarity index 100% rename from CI/steam/scripts/uninstall.bat rename to CI/steam/scripts_windows/uninstall.bat