• #">Intro#
  • #">Prerequisits#
  • #">GitHub Secrets#
    • #">Workflow Modifications#

    Intro#

    Tauri has a smooth code-signing & notarization functionality built directly into the bundler and configured via the tauri.conf.json
    This guide will give a brief overview of how to sign an application, and how to get the app notarized with Apple. All in a GitHub action.

    Prerequisits#

    • OSX - This will be needed to create/export the certificate.
    • Apple Developer Program subscription
    • Developer ID Application certificate
      • see this guide for additional help
    • Working Tauri application, being built and published via GitHub Actions, as shown in tauri-action

      GitHub Secrets#

      We will need to add a few GitHub secrets for the proper configuration of the GitHub Action. These can be named however you would like, but we must assign them to the correct Tauri variables, so keep them as relevant as possible.

    • You can view this guide for how to add GitHub secrets.

    The secrets I used are as follows

    GitHub Secrets Value for Variable
    APPLE_CERTIFICATE Base64 encoded version of your .p12 certificate. You can find a guide here
    APPLE_CERTIFICATE_PASSWORD Certificate password used on creation of certificate
    APPLE_SIGNING_IDENTITY “Developer ID Application: Your Company, Inc (XXXXXXXXX)” shown in your keychain. you can also use security find-identity -v -p codesigning on OSX to find this identity
    APPLE_ID this is the email used to request the certificate
    APPLE_PASSWORD This is an app-specific password, that must also be created by the same account used to request the certificate. Guide here

    Once we have established the GitHub Secrets we will need to make some modifications to our GitHub publish action in .github/workflows/main.yml

    Workflow Modifications#

    All we will have to do from here is assign the GitHub secrets to the proper environment variables.
    ENABLE_CODE_SIGNING: ${{ secrets.APPLE_CERTIFICATE }} APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }} APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }} APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_IDENTITY_ID }} APPLE_ID: ${{ secrets.APPLE_ID }} APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
    If you are using the tauri-action publish template, then your result should look similar the the env: portion below.

    1. name: "publish"
    2. on:
    3. push:
    4. branches:
    5. - release
    6. jobs:
    7. publish-tauri:
    8. strategy:
    9. fail-fast: false
    10. matrix:
    11. platform: [macos-latest, ubuntu-latest, windows-latest]
    12. runs-on: ${{ matrix.platform }}
    13. steps:
    14. - uses: actions/checkout@v2
    15. - name: setup node
    16. uses: actions/setup-node@v1
    17. with:
    18. node-version: 12
    19. - name: install Rust stable
    20. uses: actions-rs/toolchain@v1
    21. with:
    22. toolchain: stable
    23. - name: install webkit2gtk (ubuntu only)
    24. if: matrix.platform == 'ubuntu-latest'
    25. run: |
    26. sudo apt-get update
    27. sudo apt-get install -y webkit2gtk-4.0
    28. - name: install app dependencies and build it
    29. run: yarn && yarn build
    30. - uses: tauri-apps/tauri-action@v0
    31. env:
    32. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
    33. ENABLE_CODE_SIGNING: ${{ secrets.APPLE_CERTIFICATE }}
    34. APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
    35. APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
    36. APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_IDENTITY_ID }}
    37. APPLE_ID: ${{ secrets.APPLE_ID }}
    38. APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
    39. with:
    40. tagName: app-v__VERSION__ # the action automatically replaces \_\_VERSION\_\_ with the app version
    41. releaseName: "App v__VERSION__"
    42. releaseBody: "See the assets to download this version and install."
    43. releaseDraft: true
    44. prerelease: false