tauri-apps / tauri-action

Build your Web application as a Tauri binary for macOS, Linux and Windows
https://tauri.app
MIT License
890 stars 147 forks source link

How to skip the Notarization process in the MacOs Build #809

Closed TommasoBendinelli closed 4 months ago

TommasoBendinelli commented 4 months ago

Hi,

I would like to build an app, but I'm not currently enrolled in the Apple Developer Program. Is there a way to bypass the notarization process?

Currently I get the following:

warning: `huditor` (bin "huditor") generated 7 warnings
    Finished `release` profile [optimized] target(s) in 1m 47s
    Bundling huditor.app (/Users/runner/work/TauriAppTest/TauriAppTest/src***tauri/target/release/bundle/macos/huditor.app)
     Signing /Users/runner/work/TauriAppTest/TauriAppTest/src***tauri/target/release/bundle/macos/huditor.app with identity "***"
        Info setup keychain from environment variables...
     Signing /var/folders/lr/439_fwvd3m76p9vy50d57kcc0000gn/T/.tmpMHABdT/huditor.zip with identity "***"
        Info setup keychain from environment variables...
  Notarizing /Users/runner/work/TauriAppTest/TauriAppTest/src***tauri/target/release/bundle/macos/huditor.app
       Error failed to bundle project: failed to upload app to Apple's notarization servers.: failed to upload app to Apple's notarization servers.: `failed to run xcrun`
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

I have set this APPLE_SIGNING_IDENTITY to "-"

FabianLars commented 4 months ago

Hmm, it should skip the notarization if you don't set the APPLE_ID, APPLE_PASSWORD, APPLE_TEAM_ID env vars. If this doesn't help, are you able to share the workflow file you're using?

TommasoBendinelli commented 4 months ago

Mmm I did not set them (I have only set APPLE_CERTIFICATE, APPLE_CERTIFICATE_PASSWORD, APPLE_SIGNING_IDENTITY). Here my workflow:

name: 'publish'
on: [push]
jobs:
    publish-tauri:
        permissions:
            contents: write
        strategy:
            fail-fast: false
            matrix:
                include:
                  - platform: "macos-latest" # for Arm based macs (M1 and above).
                    args: "--target aarch64-apple-darwin"
                  - platform: "macos-latest" # for Intel based macs.
                    args: "--target x86_64-apple-darwin"
                  - platform: "ubuntu-22.04" # for Tauri v1 you could replace this with ubuntu-20.04.
                    args: ""
                  - platform: "windows-latest"
                    args: ""

        runs-on: ${{ matrix.platform }}
        steps:
            - uses: actions/checkout@v4

            - name: Get version
              id: get_version
              uses: battila7/get-version-action@v2

            - name: setup node
              uses: actions/setup-node@v3
              with:
                  node-version: 16

            - name: Install python
              uses: actions/setup-python@v5
              with:
                python-version: '3.10' 

            - name: install Rust stable
              uses: dtolnay/rust-toolchain@stable

            - name: Rust cache
              uses: swatinem/rust-cache@v2
              with:
                  workspaces: './src-tauri -> target'

            - name: install dependencies (ubuntu only)
              if: matrix.platform == 'ubuntu-22.04'
              run: |
                  sudo apt-get update
                  sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3-dev librsvg2-dev patchelf libx11-dev libxdo-dev libxcb-shape0-dev libxcb-xfixes0-dev
            - name: install dependencies (mac only)
              if: matrix.platform == 'macos-latest'
              run: |
                  rustup target add aarch64-apple-darwin
                  brew install vips

            - uses: actions/cache@v2
              with:
                  path: '**/node_modules'
                  key: ${{ runner.os }}-node-modules-${{ hashFiles('**/yarn.lock') }}

            - name: install frontend dependencies
              run: yarn install # change this to npm or pnpm depending on which one you use

            - name: Build Tauri App
              uses: tauri-apps/tauri-action@v0
              env:
                GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
                APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
                APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
                APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }}
                APPLE_ID: ${{ secrets.APPLE_ID }}
                APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
                APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
              with:
                tagName: app-v__VERSION__ # the action automatically replaces \_\_VERSION\_\_ with the app version.
                releaseName: 'App v__VERSION__'
                releaseBody: 'See the assets to download this version and install.'
                releaseDraft: true
                prerelease: false
                args: ${{ matrix.settings.args }}

This is the error I get

warning: `huditor` (bin "huditor") generated 7 warnings
    Finished `release` profile [optimized] target(s) in 1m 29s
    Bundling huditor.app (/Users/runner/work/TauriAppTest/TauriAppTest/src***tauri/target/release/bundle/macos/huditor.app)
     Signing /Users/runner/work/TauriAppTest/TauriAppTest/src***tauri/target/release/bundle/macos/huditor.app with identity "***"
        Info setup keychain from environment variables...
     Signing /var/folders/lr/439_fwvd3m76p9vy50d57kcc0000gn/T/.tmpF0FRfP/huditor.zip with identity "***"
        Info setup keychain from environment variables...
  Notarizing /Users/runner/work/TauriAppTest/TauriAppTest/src***tauri/target/release/bundle/macos/huditor.app
       Error failed to bundle project: failed to upload app to Apple's notarization servers.: failed to upload app to Apple's notarization servers.: `failed to run xcrun`
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Error: Command failed with exit code 1: yarn tauri build
FabianLars commented 4 months ago

Hmm, can you completely remove the lines mentioning the env vars for a sanity check? Just wanna see if these get interpreted as empty strings and whether tauri will pick them up as if they're not empty.

TommasoBendinelli commented 4 months ago

Ok it works if I remove the lines mentioning the env vars. Thank you! By the way, I would strongly recommend to document this better :)