summaryrefslogtreecommitdiffstats
path: root/.github/workflows/windows.yml
blob: 32b12d2db3fb0ba1839d6d793a8c7e5d49322b19 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
name: Windows Build

on: [push, pull_request]

jobs:
  build_mingw:
    name: CLI / LibHB
    runs-on: ubuntu-20.04
    steps:
    - uses: actions/checkout@v2
    - uses: actions/setup-python@v2

    - name: Environment Setup
      run: |
        sudo apt-get install automake autoconf build-essential intltool libtool libtool-bin make nasm patch tar yasm zlib1g-dev ninja-build gzip pax
        sudo pip3 install meson

    - name: Setup Toolchain
      run: |
        wget https://github.com/bradleysepos/mingw-w64-build/releases/download/9.2.0/mingw-w64-toolchain-9.2.0-linux-x86_64.tar.gz
        SHA=$(sha1sum mingw-w64-toolchain-9.2.0-linux-x86_64.tar.gz)
        EXPECTED="560ceb85cdf2783c68226d3761f865c42101c3f6  mingw-w64-toolchain-9.2.0-linux-x86_64.tar.gz"
        if [ "$SHA" == "$EXPECTED" ];
        then
            echo "Toolchain Verified. Extracting ..."
            mkdir toolchains
            mv mingw-w64-toolchain-9.2.0-linux-x86_64.tar.gz toolchains
            cd toolchains
            tar xvf mingw-w64-toolchain-9.2.0-linux-x86_64.tar.gz
            cd mingw-w64-toolchain-9.2.0-linux-x86_64/mingw-w64-x86_64/
            pwd
        else
            echo "Toolchain Verification FAILED. Exiting!"
            return -1
        fi

    - name: Build CLI and LibHB
      run: |
        export PATH="/home/runner/work/HandBrake/HandBrake/toolchains/mingw-w64-toolchain-9.1.0-linux-x86_64/mingw-w64-x86_64/bin:${PATH}"
        ./configure --cross=x86_64-w64-mingw32 --enable-qsv --enable-vce --enable-nvenc --launch-jobs=$(nproc) --launch
        cd build
        make pkg.create.zip

    - name: Upload HandBrakeCLI
      uses: actions/upload-artifact@v2
      with:
        name: HandBrakeCLI
        path: ./build/HandBrakeCLI.exe

    - name: Upload LibHB
      uses: actions/upload-artifact@v2
      with:
        name: LibHandBrake
        path: ./build/libhb/hb.dll

  build_gui:
    name: Windows UI
    runs-on: windows-latest
    needs: build_mingw
    env:
      SigningCertificate: ${{ secrets.HandBrakeTeam_SignFile }}

    steps:
    - uses: actions/checkout@v2

    - name: NuGet Restore
      run: |
         choco install nuget.commandline
         cd win/CS/
         nuget restore HandBrake.sln

    - name: Download LibHandBrake
      uses: actions/download-artifact@v2
      with:
       name: LibHandBrake
       path: win/CS/HandBrakeWPF/bin/publish

    - name: Import the Signing Cert
      run: |
        $ErrorView = "NormalView"
        if (-NOT ($env:SigningCertificate -eq '')) {
          $pfx_cert_byte = [System.Convert]::FromBase64String("${{ secrets.HandBrakeTeam_Pfx }}")
          $currentDirectory = Get-Location
          $certificatePath = Join-Path -Path $currentDirectory -ChildPath $env:SigningCertificate
          $certPassword = ConvertTo-SecureString -String ${{ secrets.HandBrakeTeam_pfx_pwd }} -Force –AsPlainText
          [IO.File]::WriteAllBytes("$certificatePath", $pfx_cert_byte)
          cp $certificatePath win\cs\
        }

    - name: Build Windows GUI
      run: |
        $env:Path += ";C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin"
        msbuild win\cs\build.xml /t:x64 /p:PfxFile=$env:SigningCertificate /p:PfxPwd=${{ secrets.HandBrakeTeam_pfx_pwd }} /p:SignTimestampServer=http://time.certum.pl/

    - name: Upload HandBrake exe Installer
      uses: actions/upload-artifact@v2
      with:
        name: HandBrake-x86_64-Win_GUI-EXE
        path: win/CS/HandBrakeWPF/bin/publish/HandBrake-Nightly-x86_64-Win_GUI.exe

    - name: Upload HandBrake msi Installer
      uses: actions/upload-artifact@v2
      with:
        name:  HandBrake-x86_64-Win_GUI-MSI
        path: win/CS/HandBrakeWPF/bin/publish/HandBrake-Nightly-x86_64-Win_GUI.msi