Open nick-stebbings opened 1 month ago
Hey @nick-stebbings ! Thanks for this. You're right in that the github workflow scaffolded with the scaffold-tauri-happ
command had some issues, I just merged this PR to ammend them.
I think what's happening is that the tauri action has the projectPath
property set to src-tauri
, which came from the scaffold-tauri-happ
command, but that's actually wrong and is what leads to the error you show. So to fix this one error, you just remove it from the parameters of the tauri action. Oh and also fix the GITHUB_TOKEN env for that step so that its value is ${{ secrets.GITHUB_TOKEN }}
while we are at it.
So you would end up with:
name: "release-tauri-app"
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
jobs:
release-tauri-app:
strategy:
fail-fast: false
matrix:
platform: [windows-2019, macos-11, ubuntu-22.04]
env:
MACOSX_DEPLOYMENT_TARGET: 10.13
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v4
- name: Support longpaths
if: matrix.platform != 'ubuntu-22.04'
run: git config --system core.longpaths true
- name: Setup pnpm
uses: pnpm/action-setup@v3 # docs https://pnpm.io/continuous-integration#github-actions
with:
version: 8 # Optional: specify a pnpm version
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
# Checks out a copy of your repository on the ubuntu-latest machine
- uses: actions/checkout@v2
- name: setup node
uses: actions/setup-node@v1
with:
node-version: 20
- name: install Rust stable
uses: actions-rs/toolchain@v1
with:
override: true
toolchain: stable
- name: install Go stable
uses: actions/setup-go@v4
with:
go-version: "stable"
- name: install dependencies (ubuntu only)
if: matrix.platform == 'ubuntu-22.04'
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.0-dev \
build-essential \
curl \
wget \
file \
libssl-dev \
libgtk-3-dev \
libayatana-appindicator3-dev \
librsvg2-dev \
javascriptcoregtk-4.1 \
libsoup-3.0 \
webkit2gtk-4.1
- name: Install and prepare
run: |
pnpm i vite -D -w
cd design-system && pnpm build
pnpm install
- name: build the app
uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tagName: v__VERSION__ # the action automatically replaces \_\_VERSION\_\_ with the app version
releaseName: "Test v__VERSION__"
releaseBody: "See assets below to download and install this version."
releaseDraft: true
prerelease: true
In that PR, I also added a publish-happ
job before the building of the tauri app itself. The purpose of that is to have the .happ be built only once, then upload that to github releases, and then have the build for the other platforms fetch that .happ and use it to build the tauri app. All of this is so that the DNA hashes match in all platforms and the apps connect across platforms. If you want to integrate that, you should also remove the npm run build:happ
from the beforeBuildCommand
property in tauri.conf.json
.
Hi @guillemcordoba Thanks for addressing this so quickly. I have got it all working, but there were some extra tweaks that were needed. Namely:
wasm32-unknown-unknown
as a build target so the config now reads:
- name: install Rust stable
uses: actions-rs/toolchain@v1
with:
override: true
toolchain: stable
target: wasm32-unknown-unknown
build:happ
step from the tauri.conf.json
beforeBuildCommand
property (it was much easier to build the .happ
locally and check it in, otherwise the workflow would need the nix environment setting up, which is too long a process, to avoid failing at hc app pack
).macos-latest
in order for github to provision a runner for that target.It is now building on all targets for me: https://github.com/HabFract/monorepo/actions/runs/9927702315/job/27422984671
Cheers!
I had to make the following changes to get to the current problem, which I believe is that the
tauri-action
github action does not work with v2 of Tauri yet.Steps to reproduce, editing the
release-tauri-app.yaml
workflow:Change to
runs-on: ${{ matrix.platform }}
(it was previously justruns-on: $
which would just hang indefinitely waiting for a runner)Add step to install pnpm
I now get runners for Windows, Ubuntu, and they get to the step for
tauri-action
and I get this error:running tauri [ 'build'] Error
tauri.conf.jsonerror on
build: Additional properties are not allowed ('devUrl', 'frontendDist' were unexpected) Error
tauri.conf.jsonerror: Additional properties are not allowed ('app', 'bundle', 'identifier', 'productName', 'version' were unexpected)
Here is a link to it failing: https://github.com/HabFract/monorepo/actions/runs/9852914196/job/27202368343
Here is my current (slightly edited to build my packages) workflow file: