#Tauri Action compile for MacOS universal without doing a seperate action

53 messages · Page 1 of 1 (latest)

wraith escarp
#

Hey, is there an easy way of telling the tauri-action to compile universal binaries when doing macos? Right now I have a seperate action for it

#

@astral mason

astral mason
wraith escarp
#

thanks! i'll take a look

wraith escarp
#

Hey @astral mason so I modified my approach just a little. Because i also want to pass in a path to a config file based on which branch is being built:

This is my action file. But what it looks like is that the config argument isn't getting handed into the action...

astral mason
#

never used env vars like this in a workflow 🤔

#

and at least one of the steps that set the var runs? asking cause their ifs are pretty specific

wraith escarp
#

yeah, i can see it set

#

well interestingly, that doesn't work on windows, but it did on mac. I wonder if theres a better way to do this, i'm basically just wanting to use a specific config depending on the branch thats running the action

astral mason
#

looks like basically the same thing though

wraith escarp
astral mason
#

maybe it's only set for bash environments then?

#

so steps that use run:

wraith escarp
#

yeah maybe...

#

well there ya go

#

nice call!

wraith escarp
#

Ok so i made some adjustments and that seems to be working ok. It was basically just some typos i had in the variables

#

i so wish testing actions had an easier way lo

#

lol

astral mason
#

i agree so much

brittle geode
#
jobs:
  publish-tauri:
    strategy:
      fail-fast: false
      matrix:
        settings:
          - platform: "macos-latest"
            args: "--target universal-apple-darwin"
          - platform: 'macos-latest'
            args: '--target x86_64-apple-darwin'
          - platform: 'macos-latest'
            args: '--target aarch64-apple-darwin'
          - platform: 'macos-latest'
            args: '--target aarch64-apple-darwin'
          - platform: "ubuntu-22.04"
            args: ""
          - platform: "windows-latest"
            args: "--target x86_64-pc-windows-msvc"
          - platform: "windows-latest"
            args: "--target i686-pc-windows-msvc"

    runs-on: ${{ matrix.settings.platform }}
#

A local build on my M1 MacMini using --target universal-apple-darwin produces both architectures

astral mason
#

did you forget the line from my second link? (not part of the code you posted)

brittle geode
#

Would that be this one?: #args: ${{ matrix.settings.args }} -c '{"package":{"productName":"injected name"},"build":{"distDir":"../dist"}}'

#

Background: I have a private repo, I deploy to a public repo from the private one. I need to generate the Universal binary (I realize that it contains both x64 and aarch64 in the bundle). Then, the updater seems to look for the proper download binary for the requesting app. I am trying to generate the proper artifacts and update.JSON that goes with it. Hope this makes sense.

#

is this line important to comment out? #updaterJsonKeepUniversal: true

#

I'm not very familiar with GitHub Actions. Honestly, I would prefer a way to do this all locally (build app, publish to my DO spaces account, and have my machine generate both the artifacts and update.json and upload them automatically, much the way electron updater did it for my old app). But I'm sure that is beyond the scope of this thread. Cheers! 😄

astral mason
brittle geode
#

Thanks!

astral mason
#

the action should be smart enough

brittle geode
#
      - name: Build and upload a GitHub release
        uses: tauri-apps/tauri-action@v0
        env:
          TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
          TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
          GITHUB_TOKEN: ${{ secrets.PAT_FOR_PUBLIC_REPO }}
          APPLE_ID: ${{ secrets.APPLE_ID }}
          APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
          APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }}
          APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
          APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
          APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
        with:
          owner: bjbk
          repo: bani-releases
          tagName: v__VERSION__
          releaseName: "Bani v__VERSION__"
          releaseBody: |
            See the assets to download and install this version.

            If you get a virus warning read this article: https://tauri.by.simon.hyll.nu/concepts/security/false_positives/.

            Windows: Run `attrib -r your-app.msi:Zone.Identifier`.
          releaseDraft: false
          prerelease: false
          args: ${{ matrix.settings.args }}
          includeUpdaterJson: true
astral mason
brittle geode
astral mason
#

right, the json file is a feature of the tauri-action github action, not the cli

#

so you'd have to create it yourself

brittle geode
#

gotcha

#

I'll see if I can learn how to automate that process myself. Thanks again! Cheers!

astral mason
#

good luck! :)

wraith escarp
#

Just catching up on this...

#

@brittle geode i have a local shell script i run to do the same thing that tauri-action does on my github workflow

#
rustup target add x86_64-apple-darwin

export APPLE_TEAM_ID="<team id>"
export APPLE_SIGNING_IDENTITY="<signing identity>"
export APPLE_ID="<appleid>"
export APPLE_PASSWORD="<apple password>"
export APPLE_CERTIFICATE="<certificate payload>"
export APPLE_CERTIFICATE_PASSWORD="<password>"
cargo tauri build --config ./apps/desktop/src-tauri/tauri.conf.json --target universal-apple-darwin
#

this is what i run locally, of course change out the config file path or omit if you don't need that (i have multiple tauri config files)

#

but this builds a universal binary on my macbook pro which has an m2 pro

#

based on info i've learned too, if you have a mac intel, this "should" still work as well now. I think they've added a cross compiler recently

#

but i just save that to a bundle.sh file in the root of my repo and then anytime i wanna build locally, i just execute it in the terminal. BUT i would add the file to your .gitignore so you don't share those secrets out to the world