diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 38c3ce9..8249c5d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,4 +1,4 @@ -name: 'CI Multiplatform Release' +name: 'CI Windows On-Push' on: push: @@ -164,7 +164,7 @@ jobs: with: name: '${{ env.GIT_TAG }}-Windows' path: ${{ github.workspace }}\obs-virtual-cam\release\*.zip - - name: 'Publish ${{ env.WIN_FILENAME }}-Installer.exe' + - name: 'Publish ${{ env.WIN_FILENAME }}-Windows-Installer.exe' if: success() uses: actions/upload-artifact@v2-preview with: diff --git a/.github/workflows/tag_release.yml b/.github/workflows/tag_release.yml new file mode 100644 index 0000000..b52e73f --- /dev/null +++ b/.github/workflows/tag_release.yml @@ -0,0 +1,215 @@ +name: 'CI Windows Release' + +on: + push: + paths-ignore: + - 'docs/**' + tags: + - '[23].[0-9]+.[0-9]+' + +jobs: + windows: + name: 'Windows 32+64bit' + runs-on: [windows-latest] + env: + QT_VERSION: '5.10.1' + WINDOWS_DEPS_VERSION: '2017' + CMAKE_GENERATOR: "Visual Studio 16 2019" + CMAKE_SYSTEM_VERSION: "10.0" + steps: + - name: 'Add msbuild to PATH' + uses: microsoft/setup-msbuild@v1.0.0 + - name: 'Checkout' + uses: actions/checkout@v2 + with: + path: ${{ github.workspace }}/obs-virtual-cam + submodules: 'recursive' + - name: 'Checkout OBS' + uses: actions/checkout@v2 + with: + repository: obsproject/obs-studio + path: ${{ github.workspace }}/obs-studio + submodules: 'recursive' + - name: 'Get OBS-Studio git info' + shell: bash + working-directory: ${{ github.workspace }}/obs-studio + run: | + git fetch --prune --unshallow + echo ::set-env name=OBS_GIT_BRANCH::$(git rev-parse --abbrev-ref HEAD) + echo ::set-env name=OBS_GIT_HASH::$(git rev-parse --short HEAD) + echo ::set-env name=OBS_GIT_TAG::$(git describe --tags --abbrev=0) + - name: 'Checkout last OBS-Studio release (${{ env.OBS_GIT_TAG }})' + shell: bash + working-directory: ${{ github.workspace }}/obs-studio + run: | + git checkout ${{ env.OBS_GIT_TAG }} + git submodule update + - name: 'Get obs-virtual-cam git info' + shell: bash + working-directory: ${{ github.workspace }}/obs-virtual-cam + run: | + git fetch --prune --unshallow + echo ::set-env name=GIT_BRANCH::${{ github.event.pull_request.head.ref }} + echo ::set-env name=GIT_HASH::$(git rev-parse --short HEAD) + echo ::set-env name=GIT_TAG::$(git describe --tags --abbrev=0) + - name: 'Install prerequisite: QT' + run: | + curl -kLO https://cdn-fastly.obsproject.com/downloads/Qt_${{ env.QT_VERSION }}.7z -f --retry 5 -C - + 7z x Qt_${{ env.QT_VERSION }}.7z -o"${{ github.workspace }}\cmbuild\QT" + - name: 'Install prerequisite: Pre-built OBS dependencies' + run: | + curl -kLO https://cdn-fastly.obsproject.com/downloads/dependencies${{ env.WINDOWS_DEPS_VERSION }}.zip -f --retry 5 -C - + 7z x dependencies${{ env.WINDOWS_DEPS_VERSION }}.zip -o"${{ github.workspace }}\cmbuild\deps" + - name: 'Restore OBS 32-bit build v${{ env.OBS_GIT_TAG }} from cache' + id: build-cache-obs-32 + uses: actions/cache@v1 + env: + CACHE_NAME: 'build-cache-obs-32' + with: + path: ${{ github.workspace }}/obs-studio/build32 + key: ${{ runner.os }}-${{ env.CACHE_NAME }}-${{ env.OBS_GIT_TAG }} + restore-keys: | + ${{ runner.os }}-${{ env.CACHE_NAME }}- + - name: 'Configure OBS 32-bit' + if: steps.build-cache-obs-32.outputs.cache-hit != 'true' + working-directory: ${{ github.workspace }}/obs-studio + run: | + mkdir .\build32 + cd .\build32 + cmake -G "${{ env.CMAKE_GENERATOR }}" -A Win32 -DCMAKE_SYSTEM_VERSION="${{ env.CMAKE_SYSTEM_VERSION }}" -DQTDIR="${{ github.workspace }}\cmbuild\QT\${{ env.QT_VERSION }}\msvc2017" -DDepsPath="${{ github.workspace }}\cmbuild\deps\win32" -DBUILD_CAPTIONS=YES -DCOPIED_DEPENDENCIES=NO -DCOPY_DEPENDENCIES=YES .. + - name: 'Build OBS-Studio 32-bit' + if: steps.build-cache-obs-32.outputs.cache-hit != 'true' + working-directory: ${{ github.workspace }}/obs-studio + run: | + msbuild /m /p:Configuration=RelWithDebInfo .\build32\libobs\libobs.vcxproj + msbuild /m /p:Configuration=RelWithDebInfo .\build32\UI\obs-frontend-api\obs-frontend-api.vcxproj + - name: 'Restore OBS 64-bit build v${{ env.OBS_GIT_TAG }} from cache' + id: build-cache-obs-64 + uses: actions/cache@v1 + env: + CACHE_NAME: 'build-cache-obs-64' + with: + path: ${{ github.workspace }}/obs-studio/build64 + key: ${{ runner.os }}-${{ env.CACHE_NAME }}-${{ env.OBS_GIT_TAG }} + restore-keys: | + ${{ runner.os }}-${{ env.CACHE_NAME }}- + - name: 'Configure OBS 64-bit' + if: steps.build-cache-obs-64.outputs.cache-hit != 'true' + working-directory: ${{ github.workspace }}/obs-studio + run: | + mkdir .\build64 + cd .\build64 + cmake -G "${{ env.CMAKE_GENERATOR }}" -A x64 -DCMAKE_SYSTEM_VERSION="${{ env.CMAKE_SYSTEM_VERSION }}" -DQTDIR="${{ github.workspace }}\cmbuild\QT\${{ env.QT_VERSION }}\msvc2017_64" -DDepsPath="${{ github.workspace }}\cmbuild\deps\win64" -DBUILD_CAPTIONS=YES -DCOPIED_DEPENDENCIES=NO -DCOPY_DEPENDENCIES=YES .. + - name: 'Build OBS-Studio 64-bit' + if: steps.build-cache-obs-64.outputs.cache-hit != 'true' + working-directory: ${{ github.workspace }}/obs-studio + run: | + msbuild /m /p:Configuration=RelWithDebInfo .\build64\libobs\libobs.vcxproj + msbuild /m /p:Configuration=RelWithDebInfo .\build64\UI\obs-frontend-api\obs-frontend-api.vcxproj + - name: 'Configure obs-virtual-cam 64-bit' + working-directory: ${{ github.workspace }}/obs-virtual-cam + run: | + mkdir .\build64 + cd .\build64 + cmake -G "${{ env.CMAKE_GENERATOR }}" -A x64 -DCMAKE_SYSTEM_VERSION="${{ env.CMAKE_SYSTEM_VERSION }}" -DQTDIR="${{ github.workspace }}\cmbuild\QT\${{ env.QT_VERSION }}\msvc2017_64" -DDepsPath="${{ github.workspace }}\cmbuild\deps\win64" -DLibObs_DIR="${{ github.workspace }}\obs-studio\build64\libobs" -DLIBOBS_INCLUDE_DIR="${{ github.workspace }}\obs-studio\libobs" -DLIBOBS_LIB="${{ github.workspace }}\obs-studio\build64\libobs\RelWithDebInfo\obs.lib" -DOBS_FRONTEND_LIB="${{ github.workspace }}\obs-studio\build64\UI\obs-frontend-api\RelWithDebInfo\obs-frontend-api.lib" -DPTHREAD_LIB="${{ github.workspace }}\obs-studio\build64\deps\w32-pthreads\RelWithDebInfo\w32-pthreads.lib" .. + - name: 'Configure obs-virtual-cam 32-bit' + working-directory: ${{ github.workspace }}/obs-virtual-cam + run: | + mkdir .\build32 + cd .\build32 + cmake -G "${{ env.CMAKE_GENERATOR }}" -A Win32 -DCMAKE_SYSTEM_VERSION="${{ env.CMAKE_SYSTEM_VERSION }}" -DQTDIR="${{ github.workspace }}\cmbuild\QT\${{ env.QT_VERSION }}\msvc2017" -DDepsPath="${{ github.workspace }}\cmbuild\deps\win32" -DLibObs_DIR="${{ github.workspace }}\obs-studio\build32\libobs" -DLIBOBS_INCLUDE_DIR="${{ github.workspace }}\obs-studio\libobs" -DLIBOBS_LIB="${{ github.workspace }}\obs-studio\build32\libobs\RelWithDebInfo\obs.lib" -DOBS_FRONTEND_LIB="${{ github.workspace }}\obs-studio\build32\UI\obs-frontend-api\RelWithDebInfo\obs-frontend-api.lib" -DPTHREAD_LIB="${{ github.workspace }}\obs-studio\build32\deps\w32-pthreads\RelWithDebInfo\w32-pthreads.lib" .. + - name: 'Build obs-virtual-cam 64-bit' + working-directory: ${{ github.workspace }}/obs-virtual-cam + run: msbuild /m /p:Configuration=RelWithDebInfo .\build64\obs-virtualcam.sln + - name: 'Build obs-virtual-cam 32-bit' + working-directory: ${{ github.workspace }}/obs-virtual-cam + run: msbuild /m /p:Configuration=RelWithDebInfo .\build32\obs-virtualcam.sln + - name: 'Set release filename' + shell: bash + run: | + FILENAME="obs-virtualcam-${{ env.GIT_TAG }}-Windows" + echo "::set-env name=WIN_FILENAME::$FILENAME" + - name: 'Package obs-virtual-cam' + working-directory: ${{ github.workspace }}/obs-virtual-cam + run: | + mkdir build-package\obs-plugins\64bit + mkdir build-package\obs-plugins\32bit + mkdir build-package\data\obs-plugins\obs-virtualoutput\locale\ + mkdir build-package\bin\64bit + mkdir build-package\bin\32bit + robocopy ${{ github.workspace }}\cmbuild\deps\win32\bin\ .\build-package\bin\32bit\ avutil-56.dll swscale-5.dll + robocopy .\build64\src\virtual-output\RelWithDebInfo .\build-package\obs-plugins\64bit\ obs-virtualoutput.dll obs-virtualoutput.stripped.pdb + robocopy .\build64\src\virtual-source\RelWithDebInfo .\build-package\bin\64bit\ obs-virtualsource.dll obs-virtualsource.stripped.pdb + robocopy .\build32\src\virtual-output\RelWithDebInfo .\build-package\obs-plugins\32bit\ obs-virtualoutput.dll obs-virtualoutput.stripped.pdb + robocopy .\build32\src\virtual-source\RelWithDebInfo .\build-package\bin\32bit\ obs-virtualsource.dll obs-virtualsource.stripped.pdb + robocopy .\locale\ .\build-package\data\obs-plugins\obs-virtualoutput\locale\ *.ini + ren .\build-package\obs-plugins\64bit\obs-virtualoutput.stripped.pdb obs-virtualoutput.pdb + ren .\build-package\obs-plugins\32bit\obs-virtualoutput.stripped.pdb obs-virtualoutput.pdb + ren .\build-package\bin\64bit\obs-virtualsource.stripped.pdb obs-virtualsource.pdb + ren .\build-package\bin\32bit\obs-virtualsource.stripped.pdb obs-virtualsource.pdb + mkdir release + 7z a ".\release\${{ env.WIN_FILENAME }}.zip" ".\build-package\*" + - name: Install NSIS + working-directory: ${{ github.workspace }}/obs-virtual-cam + run: | + Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh') + scoop bucket add extras + scoop install nsis + - name: Build obs-virtualcam installer + working-directory: ${{ github.workspace }}/obs-virtual-cam + run: | + cd installer + makensis /DVERSION=${{ env.GIT_TAG }} installer.nsi + - name: 'Publish ${{ env.WIN_FILENAME }}.zip' + if: success() + uses: actions/upload-artifact@v2-preview + with: + name: '${{ env.GIT_TAG }}-Windows' + path: ${{ github.workspace }}\obs-virtual-cam\release\*.zip + - name: 'Publish ${{ env.WIN_FILENAME }}-Installer.exe' + if: success() + uses: actions/upload-artifact@v2-preview + with: + name: '${{ env.GIT_TAG }}-Windows-Installer' + path: ${{ github.workspace }}\obs-virtual-cam\build-package\*.exe + + make-release: + name: 'Create and upload release' + runs-on: [ubuntu-latest] + needs: [windows] + steps: + - name: 'Get the version' + shell: bash + id: get_version + run: | + echo ::set-env name=TAG_VERSION::${GITHUB_REF/refs\/tags\//} + - name: 'Create Release' + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ env.TAG_VERSION }} + release_name: obs-virtualcam ${{ env.TAG_VERSION }} + draft: false + prerelease: false + - name: 'Download release artifacts' + uses: actions/download-artifact@v2-preview + - name: 'Upload Windows .zip artifact to release' + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ${{ github.workspace }}/${{ env.TAG_VERSION }}-Windows/obs-virtualcam-${{ env.TAG_VERSION }}-Windows.zip + asset_name: obs-virtualcam-${{ env.TAG_VERSION }}-Windows.zip + asset_content_type: application/zip + - name: 'Upload Windows .exe artifact to release' + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ${{ github.workspace }}/${{ env.TAG_VERSION }}-Windows-Installer/obs-virtualcam-${{ env.TAG_VERSION }}-Windows-installer.exe + asset_name: obs-virtualcam-${{ env.TAG_VERSION }}-Windows-Installer.exe + asset_content_type: application/zip