101 lines
4.1 KiB
YAML
101 lines
4.1 KiB
YAML
name: tauri-build-macos-external
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
ref:
|
|
required: true
|
|
type: string
|
|
default: 'refs/heads/main'
|
|
new_version:
|
|
required: true
|
|
type: string
|
|
default: ''
|
|
channel:
|
|
required: true
|
|
type: string
|
|
default: 'nightly'
|
|
description: 'The channel to use for this job'
|
|
jobs:
|
|
build-macos-external:
|
|
runs-on: macos-latest
|
|
steps:
|
|
- name: Getting the repo
|
|
uses: actions/checkout@v3
|
|
with:
|
|
ref: ${{ inputs.ref }}
|
|
|
|
- name: Replace Icons for Beta Build
|
|
if: inputs.channel != 'stable'
|
|
shell: bash
|
|
run: |
|
|
cp .github/scripts/icon-${{ inputs.channel }}.png src-tauri/icons/icon.png
|
|
|
|
- name: Installing node
|
|
uses: actions/setup-node@v1
|
|
with:
|
|
node-version: 20
|
|
|
|
- name: Install jq
|
|
uses: dcarbone/install-jq-action@v2.0.1
|
|
|
|
- name: Install ctoml
|
|
run: |
|
|
cargo install ctoml
|
|
|
|
- name: Create bun and uv universal
|
|
run: |
|
|
mkdir -p ./src-tauri/resources/bin/
|
|
cd ./src-tauri/resources/bin/
|
|
curl -L -o bun-darwin-x64.zip https://github.com/oven-sh/bun/releases/download/bun-v1.2.10/bun-darwin-x64.zip
|
|
curl -L -o bun-darwin-aarch64.zip https://github.com/oven-sh/bun/releases/download/bun-v1.2.10/bun-darwin-aarch64.zip
|
|
unzip bun-darwin-x64.zip
|
|
unzip bun-darwin-aarch64.zip
|
|
lipo -create -output bun-universal-apple-darwin bun-darwin-x64/bun bun-darwin-aarch64/bun
|
|
cp -f bun-darwin-aarch64/bun bun-aarch64-apple-darwin
|
|
cp -f bun-darwin-x64/bun bun-x86_64-apple-darwin
|
|
cp -f bun-universal-apple-darwin bun
|
|
|
|
curl -L -o uv-x86_64.tar.gz https://github.com/astral-sh/uv/releases/download/0.6.17/uv-x86_64-apple-darwin.tar.gz
|
|
curl -L -o uv-arm64.tar.gz https://github.com/astral-sh/uv/releases/download/0.6.17/uv-aarch64-apple-darwin.tar.gz
|
|
tar -xzf uv-x86_64.tar.gz
|
|
tar -xzf uv-arm64.tar.gz
|
|
mv uv-x86_64-apple-darwin uv-x86_64
|
|
mv uv-aarch64-apple-darwin uv-aarch64
|
|
lipo -create -output uv-universal-apple-darwin uv-x86_64/uv uv-aarch64/uv
|
|
cp -f uv-x86_64/uv uv-x86_64-apple-darwin
|
|
cp -f uv-aarch64/uv uv-aarch64-apple-darwin
|
|
cp -f uv-universal-apple-darwin uv
|
|
ls -la
|
|
|
|
- name: Update app version
|
|
run: |
|
|
echo "Version: ${{ inputs.new_version }}"
|
|
jq --arg version "${{ inputs.new_version }}" '.version = $version | .bundle.createUpdaterArtifacts = false' ./src-tauri/tauri.conf.json > /tmp/tauri.conf.json
|
|
mv /tmp/tauri.conf.json ./src-tauri/tauri.conf.json
|
|
jq --arg version "${{ inputs.new_version }}" '.version = $version' web-app/package.json > /tmp/package.json
|
|
mv /tmp/package.json web-app/package.json
|
|
ctoml ./src-tauri/Cargo.toml package.version "${{ inputs.new_version }}"
|
|
ctoml ./src-tauri/Cargo.toml dependencies.tauri.features[] "devtools"
|
|
if [ "${{ inputs.channel }}" != "stable" ]; then
|
|
jq '.plugins.updater.endpoints = ["https://delta.jan.ai/${{ inputs.channel }}/latest.json"]' ./src-tauri/tauri.conf.json > /tmp/tauri.conf.json
|
|
mv /tmp/tauri.conf.json ./src-tauri/tauri.conf.json
|
|
chmod +x .github/scripts/rename-tauri-app.sh
|
|
.github/scripts/rename-tauri-app.sh ./src-tauri/tauri.conf.json ${{ inputs.channel }}
|
|
ctoml ./src-tauri/Cargo.toml package.name "Jan-${{ inputs.channel }}"
|
|
ctoml ./src-tauri/Cargo.toml dependencies.tauri.features[] "devtools"
|
|
chmod +x .github/scripts/rename-workspace.sh
|
|
.github/scripts/rename-workspace.sh ./package.json ${{ inputs.channel }}
|
|
fi
|
|
|
|
- name: Build app
|
|
run: |
|
|
make build
|
|
env:
|
|
APP_PATH: '.'
|
|
|
|
- name: Upload Artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: jan-${{ inputs.channel }}-mac-universal-${{ inputs.new_version }}.dmg
|
|
path: |
|
|
./src-tauri/target/universal-apple-darwin/release/bundle/dmg/*.dmg |