1 name: Release (Windows)
27 name: Windows (${{ matrix.arch }})
29 runs-on: windows-latest
32 - name: Download source
33 uses: actions/download-artifact@v4
40 tar -xf source.tar.gz --strip-components=1
42 - name: Install Rust toolchain
43 uses: dtolnay/rust-toolchain@stable
45 - name: Enable Rust cache
46 uses: Swatinem/rust-cache@v2
48 - name: Setup vcpkg caching
49 uses: actions/github-script@v7
52 core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
53 core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
54 core.exportVariable('VCPKG_BINARY_SOURCES', 'clear;x-gha,readwrite')
58 git clone https://github.com/microsoft/vcpkg ${{ runner.temp }}\vcpkg
59 ${{ runner.temp }}\vcpkg\bootstrap-vcpkg.bat -disableMetrics
61 - name: Install dependencies
64 echo "::group::Install choco dependencies"
68 echo "::group::Install breakpad dependencies"
69 cargo install --locked dump_syms
72 - name: Install MSVC problem matcher
73 uses: ammaraskar/msvc-problem-matcher@master
75 - name: Configure developer command prompt for tools
76 uses: ilammy/msvc-dev-cmd@v1
87 cmake ${GITHUB_WORKSPACE} \
89 -DOPTION_TOOLS_ONLY=ON \
90 -DCMAKE_BUILD_TYPE=RelWithDebInfo \
95 cmake --build . --target tools
98 - name: Configure developer command prompt for ${{ matrix.arch }}
99 uses: ilammy/msvc-dev-cmd@v1
101 arch: ${{ matrix.host }}
103 - name: Build (with installer)
104 if: inputs.is_tag == 'true'
110 echo "::group::CMake"
111 cmake ${GITHUB_WORKSPACE} \
113 -DVCPKG_TARGET_TRIPLET=${{ matrix.arch }}-windows-static \
114 -DCMAKE_TOOLCHAIN_FILE="${{ runner.temp }}\vcpkg\scripts\buildsystems\vcpkg.cmake" \
115 -DOPTION_USE_NSIS=ON \
116 -DHOST_BINARY_DIR=${GITHUB_WORKSPACE}/build-host \
117 -DCMAKE_BUILD_TYPE=RelWithDebInfo \
118 -DOPTION_SURVEY_KEY=${{ inputs.survey_key }} \
122 echo "::group::Build"
123 cmake --build . --target openttd
126 AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
127 AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
128 AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
129 AZURE_CODESIGN_ACCOUNT_NAME: ${{ secrets.AZURE_CODESIGN_ACCOUNT_NAME }}
130 AZURE_CODESIGN_ENDPOINT: ${{ secrets.AZURE_CODESIGN_ENDPOINT }}
131 AZURE_CODESIGN_PROFILE_NAME: ${{ secrets.AZURE_CODESIGN_PROFILE_NAME }}
133 - name: Build (without installer)
134 if: inputs.is_tag != 'true'
140 echo "::group::CMake"
141 cmake ${GITHUB_WORKSPACE} \
143 -DVCPKG_TARGET_TRIPLET=${{ matrix.arch }}-windows-static \
144 -DCMAKE_TOOLCHAIN_FILE="${{ runner.temp }}\vcpkg\scripts\buildsystems\vcpkg.cmake" \
145 -DHOST_BINARY_DIR=${GITHUB_WORKSPACE}/build-host \
146 -DCMAKE_BUILD_TYPE=RelWithDebInfo \
147 -DOPTION_SURVEY_KEY=${{ inputs.survey_key }} \
151 echo "::group::Build"
152 cmake --build . --target openttd
155 AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
156 AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
157 AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
158 AZURE_CODESIGN_ACCOUNT_NAME: ${{ secrets.AZURE_CODESIGN_ACCOUNT_NAME }}
159 AZURE_CODESIGN_ENDPOINT: ${{ secrets.AZURE_CODESIGN_ENDPOINT }}
160 AZURE_CODESIGN_PROFILE_NAME: ${{ secrets.AZURE_CODESIGN_PROFILE_NAME }}
162 - name: Create breakpad symbols
166 dump_syms openttd.pdb --inlines --store symbols
168 - name: Create bundles
171 cd ${GITHUB_WORKSPACE}/build
172 echo "::group::Run CPack"
176 echo "::group::Move PDB and exe to symbols"
177 PDB_FOLDER=$(find symbols -mindepth 2 -type d)
178 cp openttd.pdb ${PDB_FOLDER}/
180 EXE_FOLDER=symbols/openttd.exe/$(grep "INFO CODE_ID" symbols/*/*/openttd.sym | cut -d\ -f3)
181 mkdir -p ${EXE_FOLDER}
182 cp openttd.exe ${EXE_FOLDER}/
185 echo "::group::Cleanup"
186 # Remove the sha256 files CPack generates; we will do this ourself at
187 # the end of this workflow.
188 rm -f bundles/*.sha256
191 - name: Sign installer
192 if: inputs.is_tag == 'true'
195 ${GITHUB_WORKSPACE}/os/windows/sign.bat "${GITHUB_WORKSPACE}/build/bundles"
197 AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
198 AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
199 AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
200 AZURE_CODESIGN_ACCOUNT_NAME: ${{ secrets.AZURE_CODESIGN_ACCOUNT_NAME }}
201 AZURE_CODESIGN_ENDPOINT: ${{ secrets.AZURE_CODESIGN_ENDPOINT }}
202 AZURE_CODESIGN_PROFILE_NAME: ${{ secrets.AZURE_CODESIGN_PROFILE_NAME }}
204 - name: Store bundles
205 uses: actions/upload-artifact@v4
207 name: openttd-windows-${{ matrix.arch }}
211 - name: Store symbols
212 uses: actions/upload-artifact@v4
214 name: symbols-windows-${{ matrix.arch }}