chore: fix unit test #324
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build Windows | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - main | |
| - 'release**' | |
| - 'test**' | |
| tags: | |
| - 'v**' | |
| jobs: | |
| build: | |
| name: Build windows binaries | |
| runs-on: windows-latest | |
| timeout-minutes: 20 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| persist-credentials: false | |
| - name: Use Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: '24' | |
| cache: 'yarn' | |
| - name: Enable Corepack | |
| run: corepack enable | |
| - name: Cache node_modules | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| .yarn/cache | |
| .yarn/install-state.gz | |
| **/node_modules | |
| key: ${{ runner.os }}-18-modules-${{ hashFiles('**/yarn.lock') }} | |
| - name: Prepare Environment | |
| run: yarn install --immutable | |
| env: | |
| CI: true | |
| - name: Cache pkg/electron binaries | |
| uses: actions/cache@v4 | |
| with: | |
| key: ${{ runner.os }}-natives-${{ hashFiles('node_modules/**/expected-shas.json') }}-${{ hashFiles('node_modules/**/electron/package.json') }} | |
| path: | | |
| ${{ github.workspace }}/.cache | |
| - name: Run build | |
| env: | |
| CI: true | |
| ELECTRON_CACHE: ${{ github.workspace }}/.cache/electron | |
| ELECTRON_BUILDER_CACHE: ${{ github.workspace }}/.cache/electron-builder | |
| PKG_CACHE_PATH: ${{ github.workspace }}/.cache/yao-pkg | |
| run: | | |
| # try and avoid timeout errors | |
| yarn do:build-win32:ci | |
| - name: Sign executables | |
| shell: bash | |
| env: | |
| WINDOWS_CERTIFICATE: ${{ secrets.WINDOWS_CERTIFICATE }} | |
| run: | | |
| if [[ ! -z "$WINDOWS_CERTIFICATE" ]]; then | |
| # write certficate to file | |
| echo "$WINDOWS_CERTIFICATE" | base64 -d > certificate.pfx | |
| for FILE in deploy/*.exe; do | |
| echo "Trying to sign ${FILE}" | |
| # This path is a bit fragile, but necessary as no signtool is on the path. | |
| # If this path breaks, then find what versions of windows kits (under "Installed Windows SDKs") are installed in the updated runner image https://github.com/actions/runner-images#available-images | |
| 'C:/Program Files (x86)/Windows Kits/10/bin/10.0.26100.0/x86/signtool.exe' sign //fd SHA256 //f certificate.pfx //p "${{ secrets.WINDOWS_CERTIFICATE_PASSWORD }}" $FILE | |
| done | |
| else | |
| echo "No certificate found" | |
| fi | |
| - name: Verify build | |
| if: '!cancelled()' | |
| run: yarn verify:build-win32 | |
| env: | |
| CI: true | |
| - name: Upload artifacts | |
| if: '!cancelled()' | |
| uses: actions/upload-artifact@v5 | |
| with: | |
| name: Windows | |
| path: deploy | |
| release: | |
| name: Create Release | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags/') | |
| needs: | |
| - build | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Download artifact | |
| uses: actions/download-artifact@v6 | |
| with: | |
| name: Windows | |
| path: deploy | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: deploy/* | |
| prerelease: ${{ contains(github.ref, '-') }} | |
| fail_on_unmatched_files: true |