Skip to content

armgit / jan

Public Imported from GitHub
0

Jan is an open source alternative to ChatGPT that runs 100% offline on your computer.

chore: migrate to selfhosted runner (#5593)

hiento09f572350c20ea
diff --git a/.github/workflows/jan-electron-build-nightly.yml b/.github/workflows/jan-electron-build-nightly.yml
deleted file mode 100644
index b4d275658..000000000
--- a/.github/workflows/jan-electron-build-nightly.yml
+++ /dev/null
@@ -1,215 +0,0 @@
-name: Electron Builder - Nightly / Manual
-
-on:
- schedule:
- - cron: '0 20 * * 1,2,3' # At 8 PM UTC on Monday, Tuesday, and Wednesday which is 3 AM UTC+7 Tuesday, Wednesday, and Thursday
- workflow_dispatch:
- inputs:
- public_provider:
- type: choice
- description: 'Public Provider'
- options:
- - none
- - aws-s3
- default: none
- pull_request:
- branches:
- - release/**
-
-jobs:
- set-public-provider:
- runs-on: ubuntu-latest
- outputs:
- public_provider: ${{ steps.set-public-provider.outputs.public_provider }}
- ref: ${{ steps.set-public-provider.outputs.ref }}
- steps:
- - name: Set public provider
- id: set-public-provider
- run: |
- if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
- echo "::set-output name=public_provider::${{ github.event.inputs.public_provider }}"
- echo "::set-output name=ref::${{ github.ref }}"
- else
- if [ "${{ github.event_name }}" == "schedule" ]; then
- echo "::set-output name=public_provider::aws-s3"
- echo "::set-output name=ref::refs/heads/dev"
- elif [ "${{ github.event_name }}" == "push" ]; then
- echo "::set-output name=public_provider::aws-s3"
- echo "::set-output name=ref::${{ github.ref }}"
- elif [ "${{ github.event_name }}" == "pull_request_review" ]; then
- echo "::set-output name=public_provider::none"
- echo "::set-output name=ref::${{ github.ref }}"
- else
- echo "::set-output name=public_provider::none"
- echo "::set-output name=ref::${{ github.ref }}"
- fi
- fi
- # Job create Update app version based on latest release tag with build number and save to output
- get-update-version:
- uses: ./.github/workflows/template-get-update-version.yml
-
- build-tauri-macos:
- uses: ./.github/workflows/template-tauri-build-macos.yml
- secrets: inherit
- needs: [get-update-version, set-public-provider]
- with:
- ref: ${{ needs.set-public-provider.outputs.ref }}
- public_provider: ${{ needs.set-public-provider.outputs.public_provider }}
- new_version: ${{ needs.get-update-version.outputs.new_version }}
- channel: nightly
- cortex_api_port: "39261"
-
- build-tauri-windows-x64:
- uses: ./.github/workflows/template-tauri-build-windows-x64.yml
- secrets: inherit
- needs: [get-update-version, set-public-provider]
- with:
- ref: ${{ needs.set-public-provider.outputs.ref }}
- public_provider: ${{ needs.set-public-provider.outputs.public_provider }}
- new_version: ${{ needs.get-update-version.outputs.new_version }}
- channel: nightly
- cortex_api_port: "39261"
-
- build-tauri-linux-x64:
- uses: ./.github/workflows/template-tauri-build-linux-x64.yml
- secrets: inherit
- needs: [get-update-version, set-public-provider]
- with:
- ref: ${{ needs.set-public-provider.outputs.ref }}
- public_provider: ${{ needs.set-public-provider.outputs.public_provider }}
- new_version: ${{ needs.get-update-version.outputs.new_version }}
- channel: nightly
- cortex_api_port: "39261"
-
- sync-temp-to-latest:
- needs: [get-update-version, set-public-provider, build-tauri-windows-x64, build-tauri-linux-x64, build-tauri-macos]
- runs-on: ubuntu-latest
- steps:
- - name: Getting the repo
- uses: actions/checkout@v3
- - name: Install jq
- uses: dcarbone/[email protected]
- - name: create latest.json file
- run: |
- VERSION=${{ needs.get-update-version.outputs.new_version }}
- PUB_DATE=$(date -u +"%Y-%m-%dT%H:%M:%S.%3NZ")
- LINUX_SIGNATURE="${{ needs.build-tauri-linux-x64.outputs.APPIMAGE_SIG }}"
- LINUX_URL="https://delta.jan.ai/nightly/${{ needs.build-tauri-linux-x64.outputs.APPIMAGE_FILE_NAME }}"
- WINDOWS_SIGNATURE="${{ needs.build-tauri-windows-x64.outputs.WIN_SIG }}"
- WINDOWS_URL="https://delta.jan.ai/nightly/${{ needs.build-tauri-windows-x64.outputs.FILE_NAME }}"
- DARWIN_SIGNATURE="${{ needs.build-tauri-macos.outputs.MAC_UNIVERSAL_SIG }}"
- DARWIN_URL="https://delta.jan.ai/nightly/Jan-nightly_${{ needs.get-update-version.outputs.new_version }}.app.tar.gz"
-
- jq --arg version "$VERSION" \
- --arg pub_date "$PUB_DATE" \
- --arg linux_signature "$LINUX_SIGNATURE" \
- --arg linux_url "$LINUX_URL" \
- --arg windows_signature "$WINDOWS_SIGNATURE" \
- --arg windows_url "$WINDOWS_URL" \
- --arg darwin_arm_signature "$DARWIN_SIGNATURE" \
- --arg darwin_arm_url "$DARWIN_URL" \
- --arg darwin_amd_signature "$DARWIN_SIGNATURE" \
- --arg darwin_amd_url "$DARWIN_URL" \
- '.version = $version
- | .pub_date = $pub_date
- | .platforms["linux-x86_64"].signature = $linux_signature
- | .platforms["linux-x86_64"].url = $linux_url
- | .platforms["windows-x86_64"].signature = $windows_signature
- | .platforms["windows-x86_64"].url = $windows_url
- | .platforms["darwin-aarch64"].signature = $darwin_arm_signature
- | .platforms["darwin-aarch64"].url = $darwin_arm_url
- | .platforms["darwin-x86_64"].signature = $darwin_amd_signature
- | .platforms["darwin-x86_64"].url = $darwin_amd_url' \
- src-tauri/latest.json.template > latest.json
- cat latest.json
- - name: Sync temp to latest
- if: ${{ needs.set-public-provider.outputs.public_provider == 'aws-s3' }}
- run: |
- aws s3 cp ./latest.json s3://${{ secrets.DELTA_AWS_S3_BUCKET_NAME }}/temp-nightly/latest.json
- aws s3 sync s3://${{ secrets.DELTA_AWS_S3_BUCKET_NAME }}/temp-nightly/ s3://${{ secrets.DELTA_AWS_S3_BUCKET_NAME }}/nightly/
- 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"
-
- noti-discord-nightly-and-update-url-readme:
- needs: [
- build-tauri-macos,
- build-tauri-windows-x64,
- build-tauri-linux-x64,
- get-update-version,
- set-public-provider,
- sync-temp-to-latest
- ]
- secrets: inherit
- if: github.event_name == 'schedule'
- uses: ./.github/workflows/template-noti-discord-and-update-url-readme.yml
- with:
- ref: refs/heads/dev
- build_reason: Nightly
- push_to_branch: dev
- new_version: ${{ needs.get-update-version.outputs.new_version }}
-
- noti-discord-pre-release-and-update-url-readme:
- needs: [
- build-tauri-macos,
- build-tauri-windows-x64,
- build-tauri-linux-x64,
- get-update-version,
- set-public-provider,
- sync-temp-to-latest
- ]
- secrets: inherit
- if: github.event_name == 'push'
- uses: ./.github/workflows/template-noti-discord-and-update-url-readme.yml
- with:
- ref: refs/heads/dev
- build_reason: Pre-release
- push_to_branch: dev
- new_version: ${{ needs.get-update-version.outputs.new_version }}
-
- noti-discord-manual-and-update-url-readme:
- needs: [
- build-tauri-macos,
- build-tauri-windows-x64,
- build-tauri-linux-x64,
- get-update-version,
- set-public-provider,
- sync-temp-to-latest
- ]
- secrets: inherit
- if: github.event_name == 'workflow_dispatch' && github.event.inputs.public_provider == 'aws-s3'
- uses: ./.github/workflows/template-noti-discord-and-update-url-readme.yml
- with:
- ref: refs/heads/dev
- build_reason: Manual
- push_to_branch: dev
- new_version: ${{ needs.get-update-version.outputs.new_version }}
-
-
- # comment-pr-build-url:
- # needs: [
- # build-tauri-macos,
- # build-tauri-windows-x64,
- # build-tauri-linux-x64,
- # get-update-version,
- # set-public-provider,
- # sync-temp-to-latest
- # ]
- # runs-on: ubuntu-latest
- # if: github.event_name == 'pull_request_review'
- # steps:
- # - name: Set up GitHub CLI
- # run: |
- # curl -sSL https://github.com/cli/cli/releases/download/v2.33.0/gh_2.33.0_linux_amd64.tar.gz | tar xz
- # sudo cp gh_2.33.0_linux_amd64/bin/gh /usr/local/bin/
-
- # - name: Comment build URL on PR
- # env:
- # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- # run: |
- # PR_URL=${{ github.event.pull_request.html_url }}
- # RUN_ID=${{ github.run_id }}
- # COMMENT="This is the build for this pull request. You can download it from the Artifacts section here: [Build URL](https://github.com/${{ github.repository }}/actions/runs/${RUN_ID})."
- # gh pr comment $PR_URL --body "$COMMENT"
\ No newline at end of file
diff --git a/.github/workflows/jan-electron-build.yml b/.github/workflows/jan-electron-build.yml
deleted file mode 100644
index a223027f3..000000000
--- a/.github/workflows/jan-electron-build.yml
+++ /dev/null
@@ -1,131 +0,0 @@
-name: Electron Builder - Tag
-
-on:
- push:
- tags: ["v[0-9]+.[0-9]+.[0-9]+"]
-
-jobs:
- # Job create Update app version based on latest release tag with build number and save to output
- get-update-version:
- uses: ./.github/workflows/template-get-update-version.yml
-
- create-draft-release:
- runs-on: ubuntu-latest
- if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
- outputs:
- upload_url: ${{ steps.create_release.outputs.upload_url }}
- version: ${{ steps.get_version.outputs.version }}
- permissions:
- contents: write
- steps:
- - name: Extract tag name without v prefix
- id: get_version
- run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV && echo "::set-output name=version::${GITHUB_REF#refs/tags/v}"
- env:
- GITHUB_REF: ${{ github.ref }}
- - name: Create Draft Release
- id: create_release
- uses: softprops/action-gh-release@v2
- with:
- tag_name: ${{ github.ref_name }}
- token: ${{ secrets.GITHUB_TOKEN }}
- name: "${{ env.VERSION }}"
- draft: true
- prerelease: false
-
- build-electron-macos:
- uses: ./.github/workflows/template-electron-build-macos.yml
- secrets: inherit
- needs: [get-update-version]
- with:
- ref: ${{ github.ref }}
- public_provider: github
- beta: false
- nightly: false
- new_version: ${{ needs.get-update-version.outputs.new_version }}
-
- build-electron-windows-x64:
- uses: ./.github/workflows/template-electron-build-windows-x64.yml
- secrets: inherit
- needs: [get-update-version]
- with:
- ref: ${{ github.ref }}
- public_provider: github
- beta: false
- nightly: false
- new_version: ${{ needs.get-update-version.outputs.new_version }}
-
- build-electron-linux-x64:
- uses: ./.github/workflows/template-electron-build-linux-x64.yml
- secrets: inherit
- needs: [get-update-version]
- with:
- ref: ${{ github.ref }}
- public_provider: github
- beta: false
- nightly: false
- new_version: ${{ needs.get-update-version.outputs.new_version }}
-
- # build-tauri-macos:
- # uses: ./.github/workflows/template-tauri-build-macos.yml
- # secrets: inherit
- # needs: [get-update-version, create-draft-release]
- # with:
- # ref: ${{ github.ref }}
- # public_provider: github
- # channel: stable
- # new_version: ${{ needs.get-update-version.outputs.new_version }}
- # upload_url: ${{ needs.create-draft-release.outputs.upload_url }}
-
- # build-tauri-windows-x64:
- # uses: ./.github/workflows/template-tauri-build-windows-x64.yml
- # secrets: inherit
- # needs: [get-update-version, create-draft-release]
- # with:
- # ref: ${{ github.ref }}
- # public_provider: github
- # channel: stable
- # new_version: ${{ needs.get-update-version.outputs.new_version }}
- # upload_url: ${{ needs.create-draft-release.outputs.upload_url }}
-
- # build-tauri-linux-x64:
- # uses: ./.github/workflows/template-tauri-build-linux-x64.yml
- # secrets: inherit
- # needs: [get-update-version, create-draft-release]
- # with:
- # ref: ${{ github.ref }}
- # public_provider: github
- # channel: stable
- # new_version: ${{ needs.get-update-version.outputs.new_version }}
- # upload_url: ${{ needs.create-draft-release.outputs.upload_url }}
-
- update_release_draft:
- needs: [
- build-electron-windows-x64,
- build-electron-linux-x64,
- build-electron-macos,
- build-tauri-windows-x64,
- build-tauri-linux-x64,
- build-tauri-macos
- ]
- permissions:
- # write permission is required to create a github release
- contents: write
- # write permission is required for autolabeler
- # otherwise, read permission is required at least
- pull-requests: write
- runs-on: ubuntu-latest
- steps:
- # (Optional) GitHub Enterprise requires GHE_HOST variable set
- #- name: Set GHE_HOST
- # run: |
- # echo "GHE_HOST=${GITHUB_SERVER_URL##https:\/\/}" >> $GITHUB_ENV
-
- # Drafts your next Release notes as Pull Requests are merged into "master"
- - uses: release-drafter/release-drafter@v5
- # (Optional) specify config name to use, relative to .github/. Default: release-drafter.yml
- # with:
- # config-name: my-config.yml
- # disable-autolabeler: true
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
\ No newline at end of file
diff --git a/.github/workflows/jan-electron-linter-and-test.yml b/.github/workflows/jan-electron-linter-and-test.yml
deleted file mode 100644
index e895baf06..000000000
--- a/.github/workflows/jan-electron-linter-and-test.yml
+++ /dev/null
@@ -1,435 +0,0 @@
-name: Test - Linter & Playwright
-on:
- workflow_dispatch:
- push:
- branches:
- - main
- - dev
- paths:
- - 'electron/**'
- - .github/workflows/jan-electron-linter-and-test.yml
- - 'web/**'
- - 'joi/**'
- - 'package.json'
- - 'node_modules/**'
- - 'yarn.lock'
- - 'core/**'
- - 'extensions/**'
- - '!README.md'
- - 'Makefile'
-
- pull_request:
- branches:
- - main
- - dev
- - release/**
- paths:
- - 'electron/**'
- - .github/workflows/jan-electron-linter-and-test.yml
- - 'web/**'
- - 'joi/**'
- - 'package.json'
- - 'node_modules/**'
- - 'yarn.lock'
- - 'Makefile'
- - 'extensions/**'
- - 'core/**'
- - 'src-tauri/**'
- - 'web-app/**'
- - '!README.md'
-
-jobs:
- base_branch_cov:
- runs-on: ubuntu-latest
- continue-on-error: true
- steps:
- - uses: actions/checkout@v3
- with:
- ref: ${{ github.base_ref }}
- - name: Use Node.js 20.x
- uses: actions/setup-node@v3
- with:
- node-version: 20
-
- - name: Install dependencies
- run: |
- make config-yarn
- yarn
- yarn build:core
-
- - name: Run test coverage
- run: yarn test:coverage
-
- - name: Upload code coverage for ref branch
- uses: actions/upload-artifact@v4
- with:
- name: ref-lcov.info
- path: ./coverage/lcov.info
-
- test-on-macos:
- if: (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) || github.event_name == 'push' || github.event_name == 'workflow_dispatch'
- runs-on: macos-latest
- steps:
- - name: Getting the repo
- uses: actions/checkout@v3
- with:
- fetch-depth: 0
-
- - name: Installing node
- uses: actions/setup-node@v3
- with:
- node-version: 20
-
- - name: Set IS_TEST environment variable
- run: |
- echo "IS_TEST=true" >> $GITHUB_ENV
-
- - name: 'Cleanup cache'
- continue-on-error: true
- run: |
- rm -rf ~/jan
- make clean
-
- - name: Get Commit Message for PR
- if: github.event_name == 'pull_request'
- run: |
- echo "REPORT_PORTAL_DESCRIPTION=${{github.event.after}})" >> $GITHUB_ENV
-
- - name: Get Commit Message for push event
- if: github.event_name == 'push'
- run: |
- echo "REPORT_PORTAL_DESCRIPTION=${{github.sha}})" >> $GITHUB_ENV
-
- # - name: 'Config report portal'
- # run: |
- # make update-playwright-config REPORT_PORTAL_URL=${{ secrets.REPORT_PORTAL_URL }} REPORT_PORTAL_API_KEY=${{ secrets.REPORT_PORTAL_API_KEY }} REPORT_PORTAL_PROJECT_NAME=${{ secrets.REPORT_PORTAL_PROJECT_NAME }} REPORT_PORTAL_LAUNCH_NAME="Jan App macos" REPORT_PORTAL_DESCRIPTION="${{env.REPORT_PORTAL_DESCRIPTION}}"
-
- - name: Linter and test
- run: |
- make test
- env:
- CSC_IDENTITY_AUTO_DISCOVERY: 'false'
-
- test-on-macos-pr-target:
- if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository
- runs-on: macos-latest
- steps:
- - name: Getting the repo
- uses: actions/checkout@v3
- with:
- fetch-depth: 0
-
- - name: Installing node
- uses: actions/setup-node@v3
- with:
- node-version: 20
-
- - name: 'Cleanup cache'
- continue-on-error: true
- run: |
- rm -rf ~/jan
- make clean
-
- - name: Linter and test
- run: |
- make test
- env:
- CSC_IDENTITY_AUTO_DISCOVERY: 'false'
-
- test-on-windows:
- if: github.event_name == 'push'
- strategy:
- fail-fast: false
- matrix:
- antivirus-tools: ['mcafee', 'default-windows-security', 'bit-defender']
- runs-on: windows-desktop-${{ matrix.antivirus-tools }}
- steps:
- - name: Getting the repo
- uses: actions/checkout@v3
- with:
- fetch-depth: 0
-
- - name: Installing node
- uses: actions/setup-node@v3
- with:
- node-version: 20
-
- - name: Install tauri-driver dependencies
- run: |
- cargo install tauri-driver --locked
-
- # Clean cache, continue on error
- - name: 'Cleanup cache'
- shell: powershell
- continue-on-error: true
- run: |
- $path = "$Env:APPDATA\jan"
- if (Test-Path $path) {
- Remove-Item "\\?\$path" -Recurse -Force
- } else {
- Write-Output "Folder does not exist."
- }
- make clean
-
- - name: Get Commit Message for push event
- if: github.event_name == 'push'
- shell: bash
- run: |
- echo "REPORT_PORTAL_DESCRIPTION=${{github.sha}}" >> $GITHUB_ENV
-
- # - name: 'Config report portal'
- # shell: bash
- # run: |
- # make update-playwright-config REPORT_PORTAL_URL=${{ secrets.REPORT_PORTAL_URL }} REPORT_PORTAL_API_KEY=${{ secrets.REPORT_PORTAL_API_KEY }} REPORT_PORTAL_PROJECT_NAME=${{ secrets.REPORT_PORTAL_PROJECT_NAME }} REPORT_PORTAL_LAUNCH_NAME="Jan App Windows ${{ matrix.antivirus-tools }}" REPORT_PORTAL_DESCRIPTION="${{env.REPORT_PORTAL_DESCRIPTION}}"
-
- - name: Linter and test
- shell: powershell
- run: |
- make test
-
- test-on-windows-pr:
- if: (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) || github.event_name == 'workflow_dispatch'
- runs-on: windows-latest
- steps:
- - name: Getting the repo
- uses: actions/checkout@v3
- with:
- fetch-depth: 0
-
- - uses: actions/cache@v4 # v4
- with:
- path: |
- ~/.cargo/bin/
- ~/.cargo/registry/index/
- ~/.cargo/registry/cache/
- ~/.cargo/git/db/
- target/
- key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-${{ hashFiles('**/yarn.lock') }}
-
- - name: Installing node
- uses: actions/setup-node@v3
- with:
- node-version: 20
-
- - name: Install tauri-driver dependencies
- run: |
- cargo install tauri-driver --locked
-
- # Clean cache, continue on error
- - name: 'Cleanup cache'
- shell: powershell
- continue-on-error: true
- run: |
- $path = "$Env:APPDATA\jan"
- if (Test-Path $path) {
- Remove-Item "\\?\$path" -Recurse -Force
- } else {
- Write-Output "Folder does not exist."
- }
- make clean
-
- - name: Get Commit Message for PR
- if: github.event_name == 'pull_request'
- shell: bash
- run: |
- echo "REPORT_PORTAL_DESCRIPTION=${{github.event.after}}" >> $GITHUB_ENV
-
- # - name: 'Config report portal'
- # shell: bash
- # run: |
- # make update-playwright-config REPORT_PORTAL_URL=${{ secrets.REPORT_PORTAL_URL }} REPORT_PORTAL_API_KEY=${{ secrets.REPORT_PORTAL_API_KEY }} REPORT_PORTAL_PROJECT_NAME=${{ secrets.REPORT_PORTAL_PROJECT_NAME }} REPORT_PORTAL_LAUNCH_NAME="Jan App Windows" REPORT_PORTAL_DESCRIPTION="${{env.REPORT_PORTAL_DESCRIPTION}}"
-
- - name: Install Prerequisites
- shell: 'powershell'
- # https://github.com/actions/runner-images/issues/9538
- # https://github.com/microsoft/playwright/pull/30009/files
- # https://github.com/tauri-apps/wry/issues/1268
- # Evergreen Bootstrapper
- # The Bootstrapper is a tiny installer that downloads
- # the Evergreen Runtime matching device architecture
- # and installs it locally.
- # https://developer.microsoft.com/en-us/microsoft-edge/webview2/consumer/?form=MA13LH
- run: |
- Invoke-WebRequest -Uri 'https://go.microsoft.com/fwlink/p/?LinkId=2124703' -OutFile 'setup.exe'
- Start-Process -FilePath setup.exe -Verb RunAs -Wait
-
- - name: Linter and test
- shell: powershell
- run: |
- make test
-
- test-on-windows-pr-target:
- if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository
- runs-on: windows-latest
- steps:
- - name: Getting the repo
- uses: actions/checkout@v3
- with:
- fetch-depth: 0
-
- - name: Installing node
- uses: actions/setup-node@v1
- with:
- node-version: 20
-
- - name: Install tauri-driver dependencies
- run: |
- cargo install tauri-driver --locked
-
- # Clean cache, continue on error
- - name: 'Cleanup cache'
- shell: powershell
- continue-on-error: true
- run: |
- $path = "$Env:APPDATA\jan"
- if (Test-Path $path) {
- Remove-Item "\\?\$path" -Recurse -Force
- } else {
- Write-Output "Folder does not exist."
- }
- make clean
-
- - name: Linter and test
- shell: powershell
- run: |
- make test
-
- test-on-ubuntu:
- runs-on: ubuntu-latest
- if: (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) || github.event_name == 'push' || github.event_name == 'workflow_dispatch'
- steps:
- - name: Getting the repo
- uses: actions/checkout@v3
- with:
- fetch-depth: 0
-
- - name: Installing node
- uses: actions/setup-node@v3
- with:
- node-version: 20
-
- - 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 webkit2gtk-driver
-
- - name: Install tauri-driver dependencies
- run: |
- cargo install tauri-driver --locked
-
- - name: 'Cleanup cache'
- continue-on-error: true
- run: |
- rm -rf ~/jan
- make clean
-
- - name: Get Commit Message for PR
- if: github.event_name == 'pull_request'
- run: |
- echo "REPORT_PORTAL_DESCRIPTION=${{github.event.after}}" >> $GITHUB_ENV
-
- - name: Get Commit Message for push event
- if: github.event_name == 'push'
- run: |
- echo "REPORT_PORTAL_DESCRIPTION=${{github.sha}}" >> $GITHUB_ENV
-
- # - name: 'Config report portal'
- # shell: bash
- # run: |
- # make update-playwright-config REPORT_PORTAL_URL=${{ secrets.REPORT_PORTAL_URL }} REPORT_PORTAL_API_KEY=${{ secrets.REPORT_PORTAL_API_KEY }} REPORT_PORTAL_PROJECT_NAME=${{ secrets.REPORT_PORTAL_PROJECT_NAME }} REPORT_PORTAL_LAUNCH_NAME="Jan App Linux" REPORT_PORTAL_DESCRIPTION="${{env.REPORT_PORTAL_DESCRIPTION}}"
-
- - name: Linter and test
- run: |
- export DISPLAY=$(w -h | awk 'NR==1 {print $2}')
- echo -e "Display ID: $DISPLAY"
- make test
-
- - uses: actions/upload-artifact@v4
- if: always()
- with:
- name: playwright-report
- path: electron/playwright-report/
- retention-days: 2
-
- # coverage-check:
- # runs-on: ubuntu-latest
- # needs: base_branch_cov
- # continue-on-error: true
- # if: (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) || github.event_name == 'push' || github.event_name == 'workflow_dispatch'
- # steps:
- # - name: Getting the repo
- # uses: actions/checkout@v3
- # with:
- # fetch-depth: 0
-
- # - name: Installing node
- # uses: actions/setup-node@v3
- # with:
- # node-version: 20
-
- # - name: Install yarn
- # run: npm install -g yarn
-
- # - name: 'Cleanup cache'
- # continue-on-error: true
- # run: |
- # rm -rf ~/jan
- # make clean
-
- # - name: Download code coverage report from base branch
- # uses: actions/download-artifact@v4
- # with:
- # name: ref-lcov.info
-
- # - name: Linter and test coverage
- # run: |
- # export DISPLAY=$(w -h | awk 'NR==1 {print $2}')
- # echo -e "Display ID: $DISPLAY"
- # make lint
- # yarn build:test
- # yarn test:coverage
-
- # - name: Generate Code Coverage report
- # id: code-coverage
- # uses: barecheck/code-coverage-action@v1
- # with:
- # github-token: ${{ secrets.GITHUB_TOKEN }}
- # lcov-file: './coverage/lcov.info'
- # base-lcov-file: './lcov.info'
- # send-summary-comment: true
- # show-annotations: 'warning'
-
- test-on-ubuntu-pr-target:
- runs-on: ubuntu-latest
- if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository
- steps:
- - name: Getting the repo
- uses: actions/checkout@v3
- with:
- fetch-depth: 0
-
- - name: Installing node
- uses: actions/setup-node@v3
- with:
- node-version: 20
-
- - 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 webkit2gtk-driver
-
- - name: Install tauri-driver dependencies
- run: |
- cargo install tauri-driver --locked
-
- - name: 'Cleanup cache'
- continue-on-error: true
- run: |
- rm -rf ~/jan
- make clean
-
- - name: Linter and test
- run: |
- export DISPLAY=$(w -h | awk 'NR==1 {print $2}')
- echo -e "Display ID: $DISPLAY"
- make test
diff --git a/.github/workflows/jan-linter-and-test.yml b/.github/workflows/jan-linter-and-test.yml
new file mode 100644
index 000000000..ae1f81f61
--- /dev/null
+++ b/.github/workflows/jan-linter-and-test.yml
@@ -0,0 +1,272 @@
+name: Test - Linter & Playwright
+on:
+ workflow_dispatch:
+ push:
+ branches:
+ - main
+ - dev
+ paths:
+ - .github/workflows/jan-linter-and-test.yml
+ - 'web/**'
+ - 'joi/**'
+ - 'package.json'
+ - 'node_modules/**'
+ - 'yarn.lock'
+ - 'core/**'
+ - 'extensions/**'
+ - '!README.md'
+ - 'Makefile'
+
+ pull_request:
+ branches:
+ - main
+ - dev
+ - release/**
+ paths:
+ - .github/workflows/jan-linter-and-test.yml
+ - 'web/**'
+ - 'joi/**'
+ - 'package.json'
+ - 'node_modules/**'
+ - 'yarn.lock'
+ - 'Makefile'
+ - 'extensions/**'
+ - 'core/**'
+ - 'src-tauri/**'
+ - 'web-app/**'
+ - '!README.md'
+
+jobs:
+ base_branch_cov:
+ runs-on: ubuntu-latest
+ continue-on-error: true
+ steps:
+ - uses: actions/checkout@v3
+ with:
+ ref: ${{ github.base_ref }}
+ - name: Use Node.js 20.x
+ uses: actions/setup-node@v3
+ with:
+ node-version: 20
+
+ - name: Install dependencies
+ run: |
+ make config-yarn
+ yarn
+ yarn build:core
+
+ - name: Run test coverage
+ run: yarn test:coverage
+
+ - name: Upload code coverage for ref branch
+ uses: actions/upload-artifact@v4
+ with:
+ name: ref-lcov.info
+ path: ./coverage/lcov.info
+
+ test-on-macos:
+ runs-on: ${{ (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository) && 'macos-latest' || 'macos-selfhosted-12-arm64' }}
+ if: github.event_name == 'pull_request' || github.event_name == 'push' || github.event_name == 'workflow_dispatch'
+ steps:
+ - name: Getting the repo
+ uses: actions/checkout@v3
+ with:
+ fetch-depth: 0
+
+ - name: Installing node
+ uses: actions/setup-node@v3
+ with:
+ node-version: 20
+
+ - name: Set IS_TEST environment variable
+ if: github.event.pull_request.head.repo.full_name == github.repository
+ run: echo "IS_TEST=true" >> $GITHUB_ENV
+
+ - name: 'Cleanup cache'
+ continue-on-error: true
+ run: |
+ rm -rf ~/jan
+ make clean
+
+ - name: Linter and test
+ run: |
+ make test
+ env:
+ CSC_IDENTITY_AUTO_DISCOVERY: 'false'
+
+ test-on-windows:
+ if: github.event_name == 'push'
+ strategy:
+ fail-fast: false
+ matrix:
+ antivirus-tools: ['mcafee', 'default-windows-security', 'bit-defender']
+ runs-on: windows-desktop-${{ matrix.antivirus-tools }}
+ steps:
+ - name: Getting the repo
+ uses: actions/checkout@v3
+ with:
+ fetch-depth: 0
+
+ - name: Installing node
+ uses: actions/setup-node@v3
+ with:
+ node-version: 20
+
+ - name: Install tauri-driver dependencies
+ run: |
+ cargo install tauri-driver --locked
+
+ # Clean cache, continue on error
+ - name: 'Cleanup cache'
+ shell: powershell
+ continue-on-error: true
+ run: |
+ $path = "$Env:APPDATA\jan"
+ if (Test-Path $path) {
+ Remove-Item "\\?\$path" -Recurse -Force
+ } else {
+ Write-Output "Folder does not exist."
+ }
+ make clean
+
+ - name: Linter and test
+ shell: powershell
+ run: |
+ make test
+
+ test-on-windows-pr:
+ if: github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'
+ runs-on: ${{ (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository) && 'windows-latest' || 'WINDOWS-11' }}
+ steps:
+ - name: Getting the repo
+ uses: actions/checkout@v3
+ with:
+ fetch-depth: 0
+
+ - name: install dependencies
+ run: |
+ choco install --yes --no-progress make
+
+ - name: Installing node
+ uses: actions/setup-node@v3
+ with:
+ node-version: 20
+
+ - name: Install tauri-driver dependencies
+ run: |
+ cargo install tauri-driver --locked
+
+ - name: 'Cleanup cache'
+ shell: powershell
+ continue-on-error: true
+ run: |
+ $path = "$Env:APPDATA\jan"
+ if (Test-Path $path) {
+ Remove-Item "\\?\$path" -Recurse -Force
+ } else {
+ Write-Output "Folder does not exist."
+ }
+ make clean
+
+ - name: Install WebView2 Runtime (Bootstrapper)
+ shell: powershell
+ run: |
+ Invoke-WebRequest -Uri 'https://go.microsoft.com/fwlink/p/?LinkId=2124703' -OutFile 'setup.exe'
+ Start-Process -FilePath setup.exe -Verb RunAs -Wait
+
+ - name: Linter and test
+ shell: powershell
+ run: |
+ make test
+ env:
+ NODE_OPTIONS: '--max-old-space-size=2048'
+
+ test-on-ubuntu:
+ runs-on: ${{ (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository) && 'ubuntu-latest' || 'ubuntu-latest' }}
+ if: github.event_name == 'pull_request' || github.event_name == 'push' || github.event_name == 'workflow_dispatch'
+ steps:
+ - name: Getting the repo
+ uses: actions/checkout@v3
+ with:
+ fetch-depth: 0
+
+ - name: Installing node
+ uses: actions/setup-node@v3
+ with:
+ node-version: 20
+
+ - 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 webkit2gtk-driver
+
+ - name: Install tauri-driver dependencies
+ run: |
+ cargo install tauri-driver --locked
+
+ - name: 'Cleanup cache'
+ continue-on-error: true
+ run: |
+ rm -rf ~/jan
+ make clean
+
+ - name: Linter and test
+ run: |
+ export DISPLAY=$(w -h | awk 'NR==1 {print $2}')
+ echo -e "Display ID: $DISPLAY"
+ make test
+
+ - uses: actions/upload-artifact@v4
+ if: always()
+ with:
+ name: playwright-report
+ path: electron/playwright-report/
+ retention-days: 2
+
+ # coverage-check:
+ # runs-on: ubuntu-latest
+ # needs: base_branch_cov
+ # continue-on-error: true
+ # if: (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) || github.event_name == 'push' || github.event_name == 'workflow_dispatch'
+ # steps:
+ # - name: Getting the repo
+ # uses: actions/checkout@v3
+ # with:
+ # fetch-depth: 0
+
+ # - name: Installing node
+ # uses: actions/setup-node@v3
+ # with:
+ # node-version: 20
+
+ # - name: Install yarn
+ # run: npm install -g yarn
+
+ # - name: 'Cleanup cache'
+ # continue-on-error: true
+ # run: |
+ # rm -rf ~/jan
+ # make clean
+
+ # - name: Download code coverage report from base branch
+ # uses: actions/download-artifact@v4
+ # with:
+ # name: ref-lcov.info
+
+ # - name: Linter and test coverage
+ # run: |
+ # export DISPLAY=$(w -h | awk 'NR==1 {print $2}')
+ # echo -e "Display ID: $DISPLAY"
+ # make lint
+ # yarn build:test
+ # yarn test:coverage
+
+ # - name: Generate Code Coverage report
+ # id: code-coverage
+ # uses: barecheck/code-coverage-action@v1
+ # with:
+ # github-token: ${{ secrets.GITHUB_TOKEN }}
+ # lcov-file: './coverage/lcov.info'
+ # base-lcov-file: './lcov.info'
+ # send-summary-comment: true
+ # show-annotations: 'warning'
diff --git a/.github/workflows/template-electron-build-linux-x64.yml b/.github/workflows/template-electron-build-linux-x64.yml
deleted file mode 100644
index cef11cb0f..000000000
--- a/.github/workflows/template-electron-build-linux-x64.yml
+++ /dev/null
@@ -1,186 +0,0 @@
-name: 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
-
-jobs:
- build-linux-x64:
- if: inputs.public_provider == 'github' || inputs.public_provider == 'none'
- runs-on: ubuntu-latest
- permissions:
- contents: write
- steps:
- - name: Getting the repo
- uses: actions/checkout@v3
- with:
- ref: ${{ inputs.ref }}
-
- - 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/[email protected] electron/icons/[email protected]
- 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/[email protected] electron/icons/[email protected]
- 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/[email protected]
-
- - name: Update app version base public_provider
- if: inputs.public_provider != 'github'
- run: |
- echo "Version: ${{ inputs.new_version }}"
- # Update the version in electron/package.json
- jq --arg version "${{ inputs.new_version }}" '.version = $version' electron/package.json > /tmp/package.json
- mv /tmp/package.json electron/package.json
- jq --arg version "${{ inputs.new_version }}" '.version = $version' web/package.json > /tmp/package.json
- mv /tmp/package.json web/package.json
- jq '.build.publish = [{"provider": "generic", "url": "https://delta.jan.ai/nightly", "channel": "latest"}, {"provider": "s3", "acl": null, "bucket": "${{ secrets.DELTA_AWS_S3_BUCKET_NAME }}", "region": "${{ secrets.DELTA_AWS_REGION}}", "path": "temp-nightly", "channel": "latest"}]' electron/package.json > /tmp/package.json
- mv /tmp/package.json electron/package.json
- cat electron/package.json
- chmod +x .github/scripts/rename-app.sh
- .github/scripts/rename-app.sh ./electron/package.json nightly
- chmod +x .github/scripts/rename-workspace.sh
- .github/scripts/rename-workspace.sh ./package.json nightly
- echo "------------------------"
- cat ./electron/package.json
- echo "------------------------"
-
- - name: Change App Name for beta version
- if: inputs.beta == true
- shell: bash
- run: |
- chmod +x .github/scripts/rename-app.sh
- .github/scripts/rename-app.sh ./electron/package.json beta
- chmod +x .github/scripts/rename-workspace.sh
- .github/scripts/rename-workspace.sh ./package.json beta
- echo "------------------------"
- cat ./electron/package.json
- echo "------------------------"
- cat ./package.json
- jq '.build.publish = [{"provider": "generic", "url": "https://delta.jan.ai/beta", "channel": "beta"}, {"provider": "s3", "acl": null, "bucket": "${{ secrets.DELTA_AWS_S3_BUCKET_NAME }}", "region": "${{ secrets.DELTA_AWS_REGION}}", "path": "temp-beta", "channel": "beta"}]' electron/package.json > /tmp/package.json
- mv /tmp/package.json electron/package.json
- cat electron/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' electron/package.json > /tmp/package.json
- mv /tmp/package.json electron/package.json
- 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: 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
- 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 }}
-
- - 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 }}
-
- - 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 }}
-
- - name: Upload Artifact .deb file
- if: inputs.public_provider != 'github'
- uses: actions/upload-artifact@v4
- with:
- name: jan-electron-linux-amd64-${{ inputs.new_version }}-deb
- path: ./electron/dist/*.deb
-
- - name: Upload Artifact .AppImage file
- if: inputs.public_provider != 'github'
- uses: actions/upload-artifact@v4
- with:
- name: jan-electron-linux-amd64-${{ inputs.new_version }}-AppImage
- path: ./electron/dist/*.AppImage
diff --git a/.github/workflows/template-electron-build-macos.yml b/.github/workflows/template-electron-build-macos.yml
deleted file mode 100644
index 8bcdcdf95..000000000
--- a/.github/workflows/template-electron-build-macos.yml
+++ /dev/null
@@ -1,233 +0,0 @@
-name: build-macos
-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
- CODE_SIGN_P12_BASE64:
- required: false
- CODE_SIGN_P12_PASSWORD:
- required: false
- APPLE_ID:
- required: false
- APPLE_APP_SPECIFIC_PASSWORD:
- required: false
- DEVELOPER_ID:
- required: false
-
-jobs:
- build-macos:
- if: inputs.public_provider == 'github' || inputs.public_provider == 'none'
- runs-on: macos-latest
- permissions:
- contents: write
- steps:
- - name: Getting the repo
- uses: actions/checkout@v3
- with:
- ref: ${{ inputs.ref }}
-
- - 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/[email protected] electron/icons/[email protected]
- 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/[email protected] electron/icons/[email protected]
- 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/[email protected]
-
- - name: Update app version based on latest release tag with build number
- if: inputs.public_provider != 'github'
- run: |
- echo "Version: ${{ inputs.new_version }}"
- # Update the version in electron/package.json
- jq --arg version "${{ inputs.new_version }}" '.version = $version' electron/package.json > /tmp/package.json
- mv /tmp/package.json electron/package.json
-
- jq --arg version "${{ inputs.new_version }}" '.version = $version' web/package.json > /tmp/package.json
- mv /tmp/package.json web/package.json
-
- jq '.build.publish = [{"provider": "generic", "url": "https://delta.jan.ai/nightly", "channel": "latest"}, {"provider": "s3", "acl": null, "bucket": "${{ secrets.DELTA_AWS_S3_BUCKET_NAME }}", "region": "${{ secrets.DELTA_AWS_REGION}}", "path": "temp-nightly", "channel": "latest"}]' electron/package.json > /tmp/package.json
- mv /tmp/package.json electron/package.json
-
- jq --arg teamid "${{ secrets.APPLE_TEAM_ID }}" '.build.mac.notarize.teamId = $teamid' electron/package.json > /tmp/package.json
- mv /tmp/package.json electron/package.json
-
- # cat electron/package.json
- chmod +x .github/scripts/rename-app.sh
- .github/scripts/rename-app.sh ./electron/package.json nightly
- chmod +x .github/scripts/rename-workspace.sh
- .github/scripts/rename-workspace.sh ./package.json nightly
- echo "------------------------"
- cat ./electron/package.json
- echo "------------------------"
-
- - name: Change App Name for beta version
- if: inputs.beta == true
- shell: bash
- run: |
- chmod +x .github/scripts/rename-app.sh
- .github/scripts/rename-app.sh ./electron/package.json beta
- chmod +x .github/scripts/rename-workspace.sh
- .github/scripts/rename-workspace.sh ./package.json beta
- echo "------------------------"
- cat ./electron/package.json
- echo "------------------------"
- cat ./package.json
- jq '.build.publish = [{"provider": "generic", "url": "https://delta.jan.ai/beta", "channel": "beta"}, {"provider": "s3", "acl": null, "bucket": "${{ secrets.DELTA_AWS_S3_BUCKET_NAME }}", "region": "${{ secrets.DELTA_AWS_REGION}}", "path": "temp-beta", "channel": "beta"}]' electron/package.json > /tmp/package.json
- mv /tmp/package.json electron/package.json
- cat electron/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' electron/package.json > /tmp/package.json
- mv /tmp/package.json electron/package.json
- jq --arg version "${VERSION_TAG#v}" '.version = $version' web/package.json > /tmp/package.json
- mv /tmp/package.json web/package.json
- jq --arg teamid "${{ secrets.APPLE_TEAM_ID }}" '.build.mac.notarize.teamId = $teamid' electron/package.json > /tmp/package.json
- mv /tmp/package.json electron/package.json
- cat electron/package.json
- env:
- VERSION_TAG: ${{ inputs.new_version }}
-
- - name: Get Cer for code signing
- run: base64 -d <<< "$CODE_SIGN_P12_BASE64" > /tmp/codesign.p12
- shell: bash
- env:
- CODE_SIGN_P12_BASE64: ${{ secrets.CODE_SIGN_P12_BASE64 }}
-
- - uses: apple-actions/import-codesign-certs@v2
- continue-on-error: true
- with:
- p12-file-base64: ${{ secrets.CODE_SIGN_P12_BASE64 }}
- p12-password: ${{ secrets.CODE_SIGN_P12_PASSWORD }}
-
- - 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
- else
- make build-and-publish
- fi
- env:
- GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- CSC_LINK: '/tmp/codesign.p12'
- CSC_KEY_PASSWORD: ${{ secrets.CODE_SIGN_P12_PASSWORD }}
- CSC_IDENTITY_AUTO_DISCOVERY: 'true'
- APPLE_ID: ${{ secrets.APPLE_ID }}
- APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }}
- APP_PATH: '.'
- DEVELOPER_ID: ${{ secrets.DEVELOPER_ID }}
- AWS_ACCESS_KEY_ID: ${{ secrets.DELTA_AWS_ACCESS_KEY_ID }}
- AWS_SECRET_ACCESS_KEY: ${{ secrets.DELTA_AWS_SECRET_ACCESS_KEY }}
- AWS_DEFAULT_REGION: auto
- 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 }}
-
- - 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 }}
- CSC_LINK: '/tmp/codesign.p12'
- CSC_KEY_PASSWORD: ${{ secrets.CODE_SIGN_P12_PASSWORD }}
- CSC_IDENTITY_AUTO_DISCOVERY: 'true'
- APPLE_ID: ${{ secrets.APPLE_ID }}
- APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }}
- APP_PATH: '.'
- DEVELOPER_ID: ${{ secrets.DEVELOPER_ID }}
- POSTHOG_KEY: ${{ secrets.POSTHOG_KEY }}
- POSTHOG_HOST: ${{ secrets.POSTHOG_HOST }}
-
- - 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 }}
- CSC_LINK: '/tmp/codesign.p12'
- CSC_KEY_PASSWORD: ${{ secrets.CODE_SIGN_P12_PASSWORD }}
- CSC_IDENTITY_AUTO_DISCOVERY: 'true'
- APPLE_ID: ${{ secrets.APPLE_ID }}
- APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }}
- APP_PATH: '.'
- DEVELOPER_ID: ${{ secrets.DEVELOPER_ID }}
- AWS_ACCESS_KEY_ID: ${{ secrets.DELTA_AWS_ACCESS_KEY_ID }}
- AWS_SECRET_ACCESS_KEY: ${{ secrets.DELTA_AWS_SECRET_ACCESS_KEY }}
- AWS_DEFAULT_REGION: auto
- AWS_EC2_METADATA_DISABLED: 'true'
- AWS_MAX_ATTEMPTS: '5'
- POSTHOG_KEY: ${{ secrets.POSTHOG_KEY }}
- POSTHOG_HOST: ${{ secrets.POSTHOG_HOST }}
-
- - name: Upload Artifact
- if: inputs.public_provider != 'github'
- uses: actions/upload-artifact@v4
- with:
- name: jan-electron-mac-universal-${{ inputs.new_version }}
- path: ./electron/dist/*.dmg
diff --git a/.github/workflows/template-electron-build-windows-x64.yml b/.github/workflows/template-electron-build-windows-x64.yml
deleted file mode 100644
index 9f71dadb0..000000000
--- a/.github/workflows/template-electron-build-windows-x64.yml
+++ /dev/null
@@ -1,230 +0,0 @@
-name: build-windows-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
- AZURE_KEY_VAULT_URI:
- required: false
- AZURE_CLIENT_ID:
- required: false
- AZURE_TENANT_ID:
- required: false
- AZURE_CLIENT_SECRET:
- required: false
- AZURE_CERT_NAME:
- required: false
-
-jobs:
- build-windows-x64:
- if: inputs.public_provider == 'github' || inputs.public_provider == 'none'
- runs-on: windows-latest
- permissions:
- contents: write
- steps:
- - name: Getting the repo
- uses: actions/checkout@v3
- with:
- ref: ${{ inputs.ref }}
-
- - 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/[email protected] electron/icons/[email protected]
- 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/[email protected] electron/icons/[email protected]
- 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/[email protected]
-
- - name: Update app version base on tag
- if: inputs.public_provider != 'github'
- id: version_update
- shell: bash
- run: |
- echo "Version: ${{ inputs.new_version }}"
- # Update the version in electron/package.json
- jq --arg version "${{ inputs.new_version }}" '.version = $version' electron/package.json > /tmp/package.json
- mv /tmp/package.json electron/package.json
-
- jq --arg version "${{ inputs.new_version }}" '.version = $version' web/package.json > /tmp/package.json
- mv /tmp/package.json web/package.json
-
- jq '.build.publish = [{"provider": "generic", "url": "https://delta.jan.ai/nightly", "channel": "latest"}, {"provider": "s3", "acl": null, "bucket": "${{ secrets.DELTA_AWS_S3_BUCKET_NAME }}", "region": "${{ secrets.DELTA_AWS_REGION}}", "path": "temp-nightly", "channel": "latest"}]' electron/package.json > /tmp/package.json
- mv /tmp/package.json electron/package.json
-
- jq '.build.win.sign = "./sign.js"' electron/package.json > /tmp/package.json
- mv /tmp/package.json electron/package.json
- cat electron/package.json
-
- chmod +x .github/scripts/rename-app.sh
- .github/scripts/rename-app.sh ./electron/package.json nightly
- chmod +x .github/scripts/rename-workspace.sh
- .github/scripts/rename-workspace.sh ./package.json nightly
- chmod +x .github/scripts/rename-uninstaller.sh
- .github/scripts/rename-uninstaller.sh nightly
- echo "------------------------"
- cat ./electron/package.json
- echo "------------------------"
- cat ./package.json
- echo "------------------------"
-
- - name: Change App Name for beta version
- if: inputs.beta == true
- shell: bash
- run: |
- chmod +x .github/scripts/rename-app.sh
- .github/scripts/rename-app.sh ./electron/package.json beta
- chmod +x .github/scripts/rename-workspace.sh
- .github/scripts/rename-workspace.sh ./package.json beta
- chmod +x .github/scripts/rename-uninstaller.sh
- .github/scripts/rename-uninstaller.sh beta
- echo "------------------------"
- cat ./electron/package.json
- echo "------------------------"
- cat ./package.json
- echo "------------------------"
- cat ./electron/scripts/uninstaller.nsh
- jq '.build.publish = [{"provider": "generic", "url": "https://delta.jan.ai/beta", "channel": "beta"}, {"provider": "s3", "acl": null, "bucket": "${{ secrets.DELTA_AWS_S3_BUCKET_NAME }}", "region": "${{ secrets.DELTA_AWS_REGION}}", "path": "temp-beta", "channel": "beta"}]' electron/package.json > /tmp/package.json
- mv /tmp/package.json electron/package.json
- cat electron/package.json
-
- - name: Update app version base on tag
- if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') && inputs.public_provider == 'github'
- shell: bash
- run: |
- jq --arg version "${VERSION_TAG#v}" '.version = $version' electron/package.json > /tmp/package.json
- mv /tmp/package.json electron/package.json
- jq --arg version "${VERSION_TAG#v}" '.version = $version' web/package.json > /tmp/package.json
- mv /tmp/package.json web/package.json
- jq '.build.win.sign = "./sign.js"' electron/package.json > /tmp/package.json
- mv /tmp/package.json electron/package.json
- env:
- VERSION_TAG: ${{ inputs.new_version }}
-
- - name: Install AzureSignTool
- run: |
- dotnet tool install --global AzureSignTool
-
- - name: Build and publish app to aws s3 r2 or github artifactory
- shell: bash
- 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
- else
- make build-and-publish
- fi
- env:
- AZURE_KEY_VAULT_URI: ${{ secrets.AZURE_KEY_VAULT_URI }}
- AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
- AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
- AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
- AZURE_CERT_NAME: homebrewltd
- AWS_ACCESS_KEY_ID: ${{ secrets.DELTA_AWS_ACCESS_KEY_ID }}
- AWS_SECRET_ACCESS_KEY: ${{ secrets.DELTA_AWS_SECRET_ACCESS_KEY }}
- AWS_DEFAULT_REGION: auto
- 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 }}
-
- - name: Build app 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 }}
- AZURE_KEY_VAULT_URI: ${{ secrets.AZURE_KEY_VAULT_URI }}
- AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
- AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
- AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
- AZURE_CERT_NAME: homebrewltd
- POSTHOG_KEY: ${{ secrets.POSTHOG_KEY }}
- POSTHOG_HOST: ${{ secrets.POSTHOG_HOST }}
-
- - name: Build app 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_DEFAULT_REGION: auto
- AWS_EC2_METADATA_DISABLED: 'true'
- AWS_MAX_ATTEMPTS: '5'
- AZURE_KEY_VAULT_URI: ${{ secrets.AZURE_KEY_VAULT_URI }}
- AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
- AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
- AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
- # AZURE_CERT_NAME: ${{ secrets.AZURE_CERT_NAME }}
- AZURE_CERT_NAME: homebrewltd
- POSTHOG_KEY: ${{ secrets.POSTHOG_KEY }}
- POSTHOG_HOST: ${{ secrets.POSTHOG_HOST }}
-
- - name: Upload Artifact
- if: inputs.public_provider != 'github'
- uses: actions/upload-artifact@v4
- with:
- name: jan-electron-win-x64-${{ inputs.new_version }}
- path: ./electron/dist/*.exe
\ No newline at end of file