Skip to content

Fix generating cert on M1 machines and sign apps in build workflow#137

Merged
sergeichestakov merged 12 commits intomainfrom
@sergeichestakov/build-with-env
Oct 16, 2023
Merged

Fix generating cert on M1 machines and sign apps in build workflow#137
sergeichestakov merged 12 commits intomainfrom
@sergeichestakov/build-with-env

Conversation

@sergeichestakov
Copy link
Copy Markdown
Contributor

@sergeichestakov sergeichestakov commented Oct 16, 2023

Why

We switched to M1 machines in this PR: #136 but we weren't actually signing them in CI during the publish step since we only generate the cert on the macOS-latest machine whereas we should actually generate it in macOS-13-xlarge as well otherwise the app will fail to sign since the cert will not be present on the machine.

Additionally, we should also run the sign step in CI during the "build" workflow. I was originally avoiding this since it takes quite a bit longer but a couple extra minutes per build is worth it since it better matches our publish step and can help us find bugs related to signing like this before we go to publish.

What changed

  • Sign apps with build workflow by passing in all the relevant env vars like we do in publish workflow
  • Generate certs for M1 Macs too during build and publish
  • Fix typo in workflows/** directory

Test plan

Build passes (particularly on Mac and Windows) and the app is signed

@sergeichestakov sergeichestakov self-assigned this Oct 16, 2023
Comment thread .github/workflows/build.yml Outdated
Comment on lines +85 to +107
- name: Generate Windows code signing certificate
if: matrix.os == 'windows-latest'
id: write_file
uses: timheuer/base64-to-file@v1.2
with:
fileName: 'windows-certificate.pfx'
encodedString: ${{ secrets.WINDOWS_CODESIGN_CERTIFICATE }}
- name: Generate MacOS code signing certificate
if: matrix.os == 'macOS-latest' || matrix.os == 'macOS-13-xlarge'
run: ./scripts/add-macos-cert.sh
env:
MACOS_CERT_P12: ${{ secrets.MACOS_CERT_P12 }}
MACOS_CERT_PASSWORD: ${{ secrets.MACOS_CERT_PASSWORD }}
- name: Make
run: pnpm run make --arch=${{ matrix.arch }}
env:
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
WINDOWS_CERTIFICATE_FILE: ${{ steps.write_file.outputs.filePath }}
WINDOWS_CERTIFICATE_PASSWORD: ${{ secrets.WINDOWS_CODESIGN_PASSWORD }}
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
DEBUG: electron-osx-sign*
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is identical to what we do in the publish workflow (see below)

Copy link
Copy Markdown
Contributor

@szymonkaliski szymonkaliski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✍️

@sergeichestakov sergeichestakov changed the title Sign apps with build workflow Fix generating cert on M1 machines and sign apps in build workflow Oct 16, 2023
@sergeichestakov sergeichestakov merged commit 780107b into main Oct 16, 2023
@sergeichestakov sergeichestakov deleted the @sergeichestakov/build-with-env branch October 16, 2023 17:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants