* refactor: deprecate vulkan binary refactor: clean up vulkan lib chore: cleanup chore: clean up chore: clean up fix: build * fix: skip binaries download env * Update src-tauri/utils/src/system.rs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update src-tauri/utils/src/system.rs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
265 lines
12 KiB
YAML
265 lines
12 KiB
YAML
name: tauri-build-linux-x64
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
ref:
|
|
required: true
|
|
type: string
|
|
default: 'refs/heads/main'
|
|
public_provider:
|
|
required: true
|
|
type: string
|
|
default: none
|
|
description: 'none: build only, github: build and publish to github, aws s3: build and publish to aws s3'
|
|
new_version:
|
|
required: true
|
|
type: string
|
|
default: ''
|
|
cortex_api_port:
|
|
required: false
|
|
type: string
|
|
default: ''
|
|
upload_url:
|
|
required: false
|
|
type: string
|
|
default: ''
|
|
channel:
|
|
required: true
|
|
type: string
|
|
default: 'nightly'
|
|
description: 'The channel to use for this job'
|
|
disable_updater:
|
|
required: false
|
|
type: boolean
|
|
default: false
|
|
description: 'If true, builds both .deb and .appimage but disables auto-updater'
|
|
secrets:
|
|
DELTA_AWS_S3_BUCKET_NAME:
|
|
required: false
|
|
DELTA_AWS_ACCESS_KEY_ID:
|
|
required: false
|
|
DELTA_AWS_SECRET_ACCESS_KEY:
|
|
required: false
|
|
TAURI_SIGNING_PRIVATE_KEY:
|
|
required: false
|
|
TAURI_SIGNING_PRIVATE_KEY_PASSWORD:
|
|
required: false
|
|
outputs:
|
|
DEB_SIG:
|
|
value: ${{ jobs.build-linux-x64.outputs.DEB_SIG }}
|
|
APPIMAGE_SIG:
|
|
value: ${{ jobs.build-linux-x64.outputs.APPIMAGE_SIG }}
|
|
APPIMAGE_FILE_NAME:
|
|
value: ${{ jobs.build-linux-x64.outputs.APPIMAGE_FILE_NAME }}
|
|
jobs:
|
|
build-linux-x64:
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
DEB_SIG: ${{ steps.packageinfo.outputs.DEB_SIG }}
|
|
APPIMAGE_SIG: ${{ steps.packageinfo.outputs.APPIMAGE_SIG }}
|
|
APPIMAGE_FILE_NAME: ${{ steps.packageinfo.outputs.APPIMAGE_FILE_NAME }}
|
|
permissions:
|
|
contents: write
|
|
steps:
|
|
- name: Getting the repo
|
|
uses: actions/checkout@v3
|
|
with:
|
|
ref: ${{ inputs.ref }}
|
|
|
|
- name: Free Disk Space Before Build
|
|
run: |
|
|
echo "Disk space before cleanup:"
|
|
df -h
|
|
sudo rm -rf /usr/local/.ghcup
|
|
sudo rm -rf /opt/hostedtoolcache/CodeQL
|
|
sudo rm -rf /usr/local/lib/android/sdk/ndk
|
|
sudo rm -rf /usr/share/dotnet
|
|
sudo rm -rf /opt/ghc
|
|
sudo rm -rf /usr/local/share/boost
|
|
sudo apt-get clean
|
|
echo "Disk space after cleanup:"
|
|
df -h
|
|
|
|
- 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: Install Tauri dependencies
|
|
run: |
|
|
sudo apt update
|
|
sudo apt install -y libglib2.0-dev libatk1.0-dev libpango1.0-dev libgtk-3-dev libsoup-3.0-dev libwebkit2gtk-4.1-dev librsvg2-dev libfuse2 libayatana-appindicator3-dev
|
|
|
|
- name: Update app version base public_provider
|
|
run: |
|
|
echo "Version: ${{ inputs.new_version }}"
|
|
# Update tauri.conf.json
|
|
jq --arg version "${{ inputs.new_version }}" '.version = $version | .bundle.createUpdaterArtifacts = true' ./src-tauri/tauri.conf.json > /tmp/tauri.conf.json
|
|
mv /tmp/tauri.conf.json ./src-tauri/tauri.conf.json
|
|
if [ "${{ inputs.channel }}" != "stable" ]; then
|
|
jq '.bundle.linux.deb.files = {"usr/bin/bun": "resources/bin/bun"}' ./src-tauri/tauri.linux.conf.json > /tmp/tauri.linux.conf.json
|
|
mv /tmp/tauri.linux.conf.json ./src-tauri/tauri.linux.conf.json
|
|
fi
|
|
jq --arg version "${{ inputs.new_version }}" '.version = $version' web-app/package.json > /tmp/package.json
|
|
mv /tmp/package.json web-app/package.json
|
|
|
|
# Update tauri plugin versions
|
|
|
|
jq --arg version "${{ inputs.new_version }}" '.version = $version' ./src-tauri/plugins/tauri-plugin-hardware/package.json > /tmp/package.json
|
|
mv /tmp/package.json ./src-tauri/plugins/tauri-plugin-hardware/package.json
|
|
|
|
echo "---------./src-tauri/plugins/tauri-plugin-hardware/package.json---------"
|
|
cat ./src-tauri/plugins/tauri-plugin-hardware/package.json
|
|
|
|
jq --arg version "${{ inputs.new_version }}" '.version = $version' ./src-tauri/plugins/tauri-plugin-llamacpp/package.json > /tmp/package.json
|
|
mv /tmp/package.json ./src-tauri/plugins/tauri-plugin-llamacpp/package.json
|
|
|
|
echo "---------./src-tauri/plugins/tauri-plugin-llamacpp/package.json---------"
|
|
cat ./src-tauri/plugins/tauri-plugin-llamacpp/package.json
|
|
|
|
ctoml ./src-tauri/plugins/tauri-plugin-hardware/Cargo.toml package.version "${{ inputs.new_version }}"
|
|
echo "---------./src-tauri/plugins/tauri-plugin-hardware/Cargo.toml---------"
|
|
cat ./src-tauri/plugins/tauri-plugin-hardware/Cargo.toml
|
|
|
|
ctoml ./src-tauri/plugins/tauri-plugin-llamacpp/Cargo.toml package.version "${{ inputs.new_version }}"
|
|
echo "---------./src-tauri/plugins/tauri-plugin-llamacpp/Cargo.toml---------"
|
|
cat ./src-tauri/plugins/tauri-plugin-llamacpp/Cargo.toml
|
|
|
|
ctoml ./src-tauri/Cargo.toml package.version "${{ inputs.new_version }}"
|
|
echo "---------./src-tauri/Cargo.toml---------"
|
|
cat ./src-tauri/Cargo.toml
|
|
|
|
# Temporarily enable devtool on prod build
|
|
ctoml ./src-tauri/Cargo.toml dependencies.tauri.features[] "devtools"
|
|
cat ./src-tauri/Cargo.toml
|
|
|
|
# Change app name for beta and nightly builds
|
|
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 }}
|
|
|
|
cat ./src-tauri/tauri.conf.json
|
|
|
|
# Update Cargo.toml
|
|
ctoml ./src-tauri/Cargo.toml package.name "Jan-${{ inputs.channel }}"
|
|
ctoml ./src-tauri/Cargo.toml dependencies.tauri.features[] "devtools"
|
|
echo "------------------"
|
|
cat ./src-tauri/Cargo.toml
|
|
|
|
chmod +x .github/scripts/rename-workspace.sh
|
|
.github/scripts/rename-workspace.sh ./package.json ${{ inputs.channel }}
|
|
cat ./package.json
|
|
fi
|
|
- name: Build app
|
|
run: |
|
|
make build
|
|
|
|
APP_IMAGE=./src-tauri/target/release/bundle/appimage/$(ls ./src-tauri/target/release/bundle/appimage/ | grep AppImage | head -1)
|
|
yarn tauri signer sign \
|
|
--private-key "$TAURI_SIGNING_PRIVATE_KEY" \
|
|
--password "$TAURI_SIGNING_PRIVATE_KEY_PASSWORD" \
|
|
"$APP_IMAGE"
|
|
|
|
env:
|
|
RELEASE_CHANNEL: '${{ inputs.channel }}'
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
POSTHOG_KEY: ${{ secrets.POSTHOG_KEY }}
|
|
POSTHOG_HOST: ${{ secrets.POSTHOG_HOST }}
|
|
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
|
|
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
|
|
AUTO_UPDATER_DISABLED: ${{ inputs.disable_updater && 'true' || 'false' }}
|
|
# Publish app
|
|
|
|
## Artifacts, for dev and test
|
|
- name: Upload Artifact
|
|
if: inputs.public_provider != 'github'
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: jan-linux-amd64-${{ inputs.new_version }}-deb
|
|
path: ./src-tauri/target/release/bundle/deb/*.deb
|
|
|
|
- name: Upload Artifact
|
|
if: inputs.public_provider != 'github'
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: jan-linux-amd64-${{ inputs.new_version }}-AppImage
|
|
path: ./src-tauri/target/release/bundle/appimage/*.AppImage
|
|
|
|
## Set output filename for linux
|
|
- name: Set output filename for linux
|
|
id: packageinfo
|
|
run: |
|
|
cd ./src-tauri/target/release/bundle
|
|
|
|
if [ "${{ inputs.channel }}" != "stable" ]; then
|
|
DEB_FILE_NAME=Jan-${{ inputs.channel }}_${{ inputs.new_version }}_amd64.deb
|
|
APPIMAGE_FILE_NAME=Jan-${{ inputs.channel }}_${{ inputs.new_version }}_amd64.AppImage
|
|
DEB_SIG=$(cat deb/Jan-${{ inputs.channel }}_${{ inputs.new_version }}_amd64.deb.sig)
|
|
APPIMAGE_SIG=$(cat appimage/Jan-${{ inputs.channel }}_${{ inputs.new_version }}_amd64.AppImage.sig)
|
|
else
|
|
DEB_FILE_NAME=Jan_${{ inputs.new_version }}_amd64.deb
|
|
APPIMAGE_FILE_NAME=Jan_${{ inputs.new_version }}_amd64.AppImage
|
|
DEB_SIG=$(cat deb/Jan_${{ inputs.new_version }}_amd64.deb.sig)
|
|
APPIMAGE_SIG=$(cat appimage/Jan_${{ inputs.new_version }}_amd64.AppImage.sig)
|
|
fi
|
|
|
|
echo "DEB_SIG=$DEB_SIG" >> $GITHUB_OUTPUT
|
|
echo "APPIMAGE_SIG=$APPIMAGE_SIG" >> $GITHUB_OUTPUT
|
|
echo "DEB_FILE_NAME=$DEB_FILE_NAME" >> $GITHUB_OUTPUT
|
|
echo "APPIMAGE_FILE_NAME=$APPIMAGE_FILE_NAME" >> $GITHUB_OUTPUT
|
|
|
|
## Upload to s3 for nightly and beta
|
|
- name: upload to aws s3 if public provider is aws
|
|
if: inputs.public_provider == 'aws-s3' || inputs.channel == 'beta'
|
|
run: |
|
|
cd ./src-tauri/target/release/bundle
|
|
|
|
# Upload for tauri updater
|
|
aws s3 cp ./appimage/Jan-${{ inputs.channel }}_${{ inputs.new_version }}_amd64.AppImage s3://${{ secrets.DELTA_AWS_S3_BUCKET_NAME }}/temp-${{ inputs.channel }}/Jan-${{ inputs.channel }}_${{ inputs.new_version }}_amd64.AppImage
|
|
aws s3 cp ./deb/Jan-${{ inputs.channel }}_${{ inputs.new_version }}_amd64.deb s3://${{ secrets.DELTA_AWS_S3_BUCKET_NAME }}/temp-${{ inputs.channel }}/Jan-${{ inputs.channel }}_${{ inputs.new_version }}_amd64.deb
|
|
aws s3 cp ./appimage/Jan-${{ inputs.channel }}_${{ inputs.new_version }}_amd64.AppImage.sig s3://${{ secrets.DELTA_AWS_S3_BUCKET_NAME }}/temp-${{ inputs.channel }}/Jan-${{ inputs.channel }}_${{ inputs.new_version }}_amd64.AppImage.sig
|
|
aws s3 cp ./deb/Jan-${{ inputs.channel }}_${{ inputs.new_version }}_amd64.deb.sig s3://${{ secrets.DELTA_AWS_S3_BUCKET_NAME }}/temp-${{ inputs.channel }}/Jan-${{ inputs.channel }}_${{ inputs.new_version }}_amd64.deb.sig
|
|
env:
|
|
AWS_ACCESS_KEY_ID: ${{ secrets.DELTA_AWS_ACCESS_KEY_ID }}
|
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.DELTA_AWS_SECRET_ACCESS_KEY }}
|
|
AWS_DEFAULT_REGION: ${{ secrets.DELTA_AWS_REGION }}
|
|
AWS_EC2_METADATA_DISABLED: 'true'
|
|
|
|
- name: Upload release assert if public provider is github
|
|
if: inputs.public_provider == 'github'
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
uses: actions/upload-release-asset@v1.0.1
|
|
with:
|
|
upload_url: ${{ inputs.upload_url }}
|
|
asset_path: ./src-tauri/target/release/bundle/appimage/${{ steps.packageinfo.outputs.APPIMAGE_FILE_NAME }}
|
|
asset_name: ${{ steps.packageinfo.outputs.APPIMAGE_FILE_NAME }}
|
|
asset_content_type: application/octet-stream
|
|
|
|
- name: Upload release assert if public provider is github
|
|
if: inputs.public_provider == 'github'
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
uses: actions/upload-release-asset@v1.0.1
|
|
with:
|
|
upload_url: ${{ inputs.upload_url }}
|
|
asset_path: ./src-tauri/target/release/bundle/deb/${{ steps.packageinfo.outputs.DEB_FILE_NAME }}
|
|
asset_name: ${{ steps.packageinfo.outputs.DEB_FILE_NAME }}
|
|
asset_content_type: application/octet-stream
|