241 lines
9.5 KiB
YAML
241 lines
9.5 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: ''
|
|
aws_s3_prefix:
|
|
required: false
|
|
type: string
|
|
default: '/latest/'
|
|
beta:
|
|
required: false
|
|
type: boolean
|
|
default: false
|
|
nightly:
|
|
required: false
|
|
type: boolean
|
|
default: false
|
|
cortex_api_port:
|
|
required: false
|
|
type: string
|
|
default: null
|
|
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
|
|
TAURI_SIGNING_PUBLIC_KEY:
|
|
required: false
|
|
|
|
jobs:
|
|
build-linux-x64:
|
|
runs-on: ubuntu-22.04
|
|
environment: production
|
|
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.beta == true && inputs.nightly != true
|
|
# shell: bash
|
|
# run: |
|
|
# rm -rf electron/icons/*
|
|
|
|
# cp electron/icons_dev/jan-beta-512x512.png electron/icons/512x512.png
|
|
# cp electron/icons_dev/jan-beta.ico electron/icons/icon.ico
|
|
# cp electron/icons_dev/jan-beta.png electron/icons/icon.png
|
|
# cp electron/icons_dev/jan-beta-tray@2x.png electron/icons/icon-tray@2x.png
|
|
# cp electron/icons_dev/jan-beta-tray.png electron/icons/icon-tray.png
|
|
|
|
# - name: Replace Icons for Nightly Build
|
|
# if: inputs.nightly == true && inputs.beta != true
|
|
# shell: bash
|
|
# run: |
|
|
# rm -rf electron/icons/*
|
|
|
|
# cp electron/icons_dev/jan-nightly-512x512.png electron/icons/512x512.png
|
|
# cp electron/icons_dev/jan-nightly.ico electron/icons/icon.ico
|
|
# cp electron/icons_dev/jan-nightly.png electron/icons/icon.png
|
|
# cp electron/icons_dev/jan-nightly-tray@2x.png electron/icons/icon-tray@2x.png
|
|
# cp electron/icons_dev/jan-nightly-tray.png electron/icons/icon-tray.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 dependecies
|
|
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
|
|
|
|
- name: Update app version base public_provider
|
|
if: inputs.public_provider != 'github'
|
|
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
|
|
|
|
chmod +x .github/scripts/rename-tauri-app.sh
|
|
.github/scripts/rename-tauri-app.sh ./src-tauri/tauri.conf.json nightly
|
|
|
|
echo ./src-tauri/tauri.conf.json
|
|
|
|
# Update Cargo.toml
|
|
ctoml ./src-tauri/Cargo.toml package.name "Jan-nightly"
|
|
ctoml ./src-tauri/Cargo.toml package.version "${{ inputs.new_version }}"
|
|
echo "------------------"
|
|
cat ./src-tauri/Cargo.toml
|
|
|
|
chmod +x .github/scripts/rename-workspace.sh
|
|
.github/scripts/rename-workspace.sh ./package.json nightly
|
|
|
|
- name: Change App Name for beta version
|
|
if: inputs.beta == true
|
|
shell: bash
|
|
run: |
|
|
chmod +x .github/scripts/rename-tauri-app.sh
|
|
.github/scripts/rename-tauri-app.sh ./src-tauri/tauri.conf.json beta
|
|
cat ./src-tauri/tauri.conf.json
|
|
echo "------------------"
|
|
ctoml ./src-tauri/Cargo.toml package.name "Jan-beta"
|
|
cat ./src-tauri/Cargo.toml
|
|
echo "------------------"
|
|
chmod +x .github/scripts/rename-workspace.sh
|
|
.github/scripts/rename-workspace.sh ./package.json beta
|
|
cat ./package.json
|
|
|
|
- name: Update app version base on tag
|
|
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') && inputs.public_provider == 'github'
|
|
run: |
|
|
jq --arg version "${VERSION_TAG#v}" '.version = $version | .bundle.createUpdaterArtifacts = true' ./src-tauri/tauri.conf.json > /tmp/tauri.conf.json
|
|
mv /tmp/tauri.conf.json ./src-tauri/tauri.conf.json
|
|
ctoml ./src-tauri/Cargo.toml package.version "${VERSION_TAG#v}"
|
|
jq --arg version "${VERSION_TAG#v}" '.version = $version' web/package.json > /tmp/package.json
|
|
mv /tmp/package.json web/package.json
|
|
env:
|
|
VERSION_TAG: ${{ inputs.new_version }}
|
|
|
|
- name: Inject Tauri Signing Public Key
|
|
run: |
|
|
if [ -f "src-tauri/tauri.conf.json" ]; then
|
|
echo "Injecting Tauri public key into configuration..."
|
|
# Use jq to update the pubkey field in the tauri.conf.json file
|
|
jq --arg pubkey "$TAURI_SIGNING_PUBLIC_KEY" '.plugins.updater.pubkey = $pubkey' src-tauri/tauri.conf.json > /tmp/tauri.conf.json
|
|
mv /tmp/tauri.conf.json src-tauri/tauri.conf.json
|
|
echo "Tauri configuration updated successfully"
|
|
else
|
|
echo "tauri.conf.json not found"
|
|
fi
|
|
env:
|
|
TAURI_SIGNING_PUBLIC_KEY: ${{ secrets.TAURI_SIGNING_PUBLIC_KEY }}
|
|
|
|
- name: Build and publish app to aws s3 r2 or github artifactory
|
|
if: inputs.public_provider != 'github'
|
|
run: |
|
|
# check public_provider is true or not
|
|
echo "public_provider is ${{ inputs.public_provider }}"
|
|
if [ "${{ inputs.public_provider }}" == "none" ]; then
|
|
make build-tauri
|
|
else
|
|
make build-and-publish
|
|
fi
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
AWS_ACCESS_KEY_ID: ${{ secrets.DELTA_AWS_ACCESS_KEY_ID }}
|
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.DELTA_AWS_SECRET_ACCESS_KEY }}
|
|
AWS_EC2_METADATA_DISABLED: 'true'
|
|
AWS_MAX_ATTEMPTS: '5'
|
|
POSTHOG_KEY: ${{ secrets.POSTHOG_KEY }}
|
|
POSTHOG_HOST: ${{ secrets.POSTHOG_HOST }}
|
|
# CORTEX_API_PORT: ${{ inputs.cortex_api_port }}
|
|
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
|
|
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
|
|
TAURI_SIGNING_PUBLIC_KEY: ${{ secrets.TAURI_SIGNING_PUBLIC_KEY }}
|
|
|
|
- name: Build and publish app to github
|
|
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') && inputs.public_provider == 'github' && inputs.beta == false
|
|
run: |
|
|
make build-and-publish
|
|
env:
|
|
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 }}
|
|
TAURI_SIGNING_PUBLIC_KEY: ${{ secrets.TAURI_SIGNING_PUBLIC_KEY }}
|
|
|
|
- name: Build and publish app to github
|
|
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') && inputs.public_provider == 'github' && inputs.beta == true
|
|
run: |
|
|
make build-and-publish
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
AWS_ACCESS_KEY_ID: ${{ secrets.DELTA_AWS_ACCESS_KEY_ID }}
|
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.DELTA_AWS_SECRET_ACCESS_KEY }}
|
|
AWS_EC2_METADATA_DISABLED: 'true'
|
|
AWS_MAX_ATTEMPTS: '5'
|
|
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 }}
|
|
TAURI_SIGNING_PUBLIC_KEY: ${{ secrets.TAURI_SIGNING_PUBLIC_KEY }}
|
|
|
|
- name: Upload Artifact .deb file
|
|
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 .AppImage file
|
|
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 |