Jan is an open source alternative to ChatGPT that runs 100% offline on your computer.
refactor: jan web ci to use main branch and deprecate old workflows
Minh1411203335b48e2bfd
diff --git a/.github/workflows/jan-astro-docs.yml b/.github/workflows/jan-astro-docs.ymldeleted file mode 100644index 1e75e768c..000000000--- a/.github/workflows/jan-astro-docs.yml+++ /dev/null@@ -1,145 +0,0 @@-name: Jan Astro Docs--on:- push:- branches:- - dev- paths:- - 'website/**'- - '.github/workflows/jan-astro-docs.yml'- pull_request:- paths:- - 'website/**'- - '.github/workflows/jan-astro-docs.yml'- # Review gh actions docs if you want to further define triggers, paths, etc- # https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#on- workflow_dispatch:- inputs:- update_cloud_spec:- description: 'Update Jan Server API specification'- required: false- default: 'false'- type: choice- options:- - 'true'- - 'false'- schedule:- # Run daily at 2 AM UTC to sync with Jan Server updates- - cron: '0 2 * * *'--jobs:- deploy:- name: Deploy to CloudFlare Pages- env:- CLOUDFLARE_PROJECT_NAME: astro-docs # docs.jan.ai- runs-on: ubuntu-latest- permissions:- contents: write- deployments: write- pull-requests: write- steps:- - uses: actions/checkout@v3- - uses: actions/setup-node@v3- with:- node-version: 20-- - uses: oven-sh/setup-bun@v2-- - name: Install jq- uses: dcarbone/[email protected]-- - name: Fill env vars- continue-on-error: true- working-directory: website- run: |- env_example_file=".env.example"- touch .env- while IFS= read -r line || [[ -n "$line" ]]; do- if [[ "$line" == *"="* ]]; then- var_name=$(echo $line | cut -d '=' -f 1)- echo $var_name- var_value="$(jq -r --arg key "$var_name" '.[$key]' <<< "$SECRETS")"- echo "$var_name=$var_value" >> .env- fi- done < "$env_example_file"- env:- SECRETS: '${{ toJson(secrets) }}'-- - name: Install dependencies- working-directory: website- run: bun install-- - name: Update Jan Server API Spec (Scheduled/Manual)- if: github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && github.event.inputs.update_cloud_spec == 'true')- working-directory: website- continue-on-error: true- run: |- echo "π‘ Updating Jan Server API specification..."- bun run generate:cloud-spec-- # Check if the spec file was updated- if git diff --quiet public/openapi/cloud-openapi.json; then- echo "β No changes to API specification"- else- echo "π API specification updated"- # Commit the changes if this is a scheduled run on main branch- if [ "${{ github.event_name }}" = "schedule" ] && [ "${{ github.ref }}" = "refs/heads/dev" ]; then- git config --local user.email "github-actions[bot]@users.noreply.github.com"- git config --local user.name "github-actions[bot]"- git add public/openapi/cloud-openapi.json- git commit -m "chore: update Jan Server API specification [skip ci]"- git push- fi- fi- env:- JAN_SERVER_SPEC_URL: ${{ secrets.JAN_SERVER_SPEC_URL || 'https://api.jan.ai/api/swagger/doc.json' }}- JAN_SERVER_PROD_URL: ${{ secrets.JAN_SERVER_PROD_URL || 'https://api.jan.ai/v1' }}- - name: Build website- working-directory: website- run: |- # For PR and regular pushes, skip cloud spec generation in prebuild- # It will use the existing committed spec or fallback- if [ "${{ github.event_name }}" = "pull_request" ] || [ "${{ github.event_name }}" = "push" ]; then- echo "Using existing cloud spec for build"- export SKIP_CLOUD_SPEC_UPDATE=true- fi- bun run build- env:- SKIP_CLOUD_SPEC_UPDATE: ${{ github.event_name == 'pull_request' || github.event_name == 'push' }}-- - name: copy redirects and headers- continue-on-error: true- working-directory: website- run: |- cp _redirects dist/_redirects- cp _headers dist/_headers-- - name: Publish to Cloudflare Pages PR Preview and Staging- if: github.event_name == 'pull_request'- uses: cloudflare/pages-action@v1- with:- apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}- accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}- projectName: ${{ env.CLOUDFLARE_PROJECT_NAME }}- directory: ./website/dist- # Optional: Enable this if you want to have GitHub Deployments triggered- gitHubToken: ${{ secrets.GITHUB_TOKEN }}- id: deployCloudflarePages-- - uses: mshick/add-pr-comment@v2- if: github.event_name == 'pull_request'- with:- message: |- Preview URL Astro Docs: ${{ steps.deployCloudflarePages.outputs.url }}-- - name: Publish to Cloudflare Pages Production- if: (github.event_name == 'push' && github.ref == 'refs/heads/dev') || (github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/dev')- uses: cloudflare/pages-action@v1- with:- apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}- accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}- projectName: ${{ env.CLOUDFLARE_PROJECT_NAME }}- directory: ./website/dist- branch: main- # Optional: Enable this if you want to have GitHub Deployments triggered- gitHubToken: ${{ secrets.GITHUB_TOKEN }}diff --git a/.github/workflows/jan-docs.yml b/.github/workflows/jan-docs.ymlindex e6cc0977b..892f6ae46 100644--- a/.github/workflows/jan-docs.yml+++ b/.github/workflows/jan-docs.yml@@ -3,7 +3,7 @@ name: Jan Docson:push:branches:- - dev+ - mainpaths:- 'docs/**'- '.github/workflows/jan-docs.yml'@@ -79,7 +79,7 @@ jobs:Preview URL: ${{ steps.deployCloudflarePages.outputs.url }}- name: Publish to Cloudflare Pages Production- if: (github.event_name == 'push' && github.ref == 'refs/heads/dev') || (github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/dev') || (github.event_name == 'workflow_dispatch' && startsWith(github.ref, 'refs/heads/release/'))+ if: (github.event_name == 'push' && github.ref == 'refs/heads/main') || (github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main') || (github.event_name == 'workflow_dispatch' && startsWith(github.ref, 'refs/heads/release/'))uses: cloudflare/pages-action@v1with:apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}diff --git a/.github/workflows/jan-linter-and-test.yml b/.github/workflows/jan-linter-and-test.ymlindex 92d11cf5a..65fa1cf59 100644--- a/.github/workflows/jan-linter-and-test.yml+++ b/.github/workflows/jan-linter-and-test.yml@@ -4,7 +4,6 @@ on:push:branches:- main- - devpaths:- .github/workflows/jan-linter-and-test.yml- 'web/**'@@ -20,7 +19,6 @@ on:pull_request:branches:- main- - dev- release/**paths:- .github/workflows/jan-linter-and-test.ymldiff --git a/.github/workflows/jan-server-web-ci-dev.yml b/.github/workflows/jan-server-web-ci-dev.ymldeleted file mode 100644index 2b8bbb7aa..000000000--- a/.github/workflows/jan-server-web-ci-dev.yml+++ /dev/null@@ -1,60 +0,0 @@-name: Jan Web Server build image and push to Harbor Registry--on:- push:- branches:- - dev-web- pull_request:- branches:- - dev-web--jobs:- build-and-preview:- runs-on: [ubuntu-24-04-docker]- env:- JAN_BASE_URL: "https://api-dev.jan.ai/v1"- permissions:- pull-requests: write- contents: write- steps:- - name: Checkout source repo- uses: actions/checkout@v4-- - name: Login to Harbor Registry- uses: docker/login-action@v3- with:- registry: registry.menlo.ai- username: ${{ secrets.HARBOR_USERNAME }}- password: ${{ secrets.HARBOR_PASSWORD }}-- - name: Install dependencies- run: |- (type -p wget >/dev/null || (sudo apt update && sudo apt install wget -y)) \- && sudo mkdir -p -m 755 /etc/apt/keyrings \- && out=$(mktemp) && wget -nv -O$out https://cli.github.com/packages/githubcli-archive-keyring.gpg \- && cat $out | sudo tee /etc/apt/keyrings/githubcli-archive-keyring.gpg > /dev/null \- && sudo chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg \- && sudo mkdir -p -m 755 /etc/apt/sources.list.d \- && echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \- && sudo apt update- sudo apt-get install -y jq gettext-- - name: Set image tag- id: vars- run: |- if [[ "${{ github.event_name }}" == "pull_request" ]]; then- IMAGE_TAG="web:preview-${{ github.sha }}"- else- IMAGE_TAG="web:dev-${{ github.sha }}"- fi- echo "IMAGE_TAG=${IMAGE_TAG}" >> $GITHUB_OUTPUT- echo "FULL_IMAGE=registry.menlo.ai/jan-server/${IMAGE_TAG}" >> $GITHUB_OUTPUT-- - name: Build docker image- run: |- docker build --build-arg JAN_BASE_URL=${{ env.JAN_BASE_URL }} -t ${{ steps.vars.outputs.FULL_IMAGE }} .-- - name: Push docker image- if: github.event_name == 'push'- run: |- docker push ${{ steps.vars.outputs.FULL_IMAGE }}diff --git a/.github/workflows/jan-server-web-ci-prod.yml b/.github/workflows/jan-server-web-ci-prod.ymldeleted file mode 100644index cc4d31895..000000000--- a/.github/workflows/jan-server-web-ci-prod.yml+++ /dev/null@@ -1,58 +0,0 @@-name: Jan Web Server deploy to production--on:- push:- branches:- - prod-web--jobs:- build-and-deploy:- runs-on: ubuntu-latest- permissions:- contents: write- deployments: write- pull-requests: write- env:- JAN_BASE_URL: "https://api.jan.ai/v1"- GA_MEASUREMENT_ID: "G-YK53MX8M8M"- CLOUDFLARE_PROJECT_NAME: "jan-server-web"- steps:- - uses: actions/checkout@v4- - uses: actions/setup-node@v3- with:- node-version: 20-- - name: Install jq- uses: dcarbone/[email protected]-- # - name: Fill env vars- # run: |- # env_example_file=".env.example"- # touch .env- # while IFS= read -r line || [[ -n "$line" ]]; do- # if [[ "$line" == *"="* ]]; then- # var_name=$(echo $line | cut -d '=' -f 1)- # echo $var_name- # var_value="$(jq -r --arg key "$var_name" '.[$key]' <<< "$SECRETS")"- # echo "$var_name=$var_value" >> .env- # fi- # done < "$env_example_file"- # env:- # SECRETS: '${{ toJson(secrets) }}'-- - name: Install dependencies- run: make config-yarn && yarn install && yarn build:core && make build-web-app- env:- JAN_BASE_URL: ${{ env.JAN_BASE_URL }}- GA_MEASUREMENT_ID: ${{ env.GA_MEASUREMENT_ID }}-- - name: Publish to Cloudflare Pages Production- uses: cloudflare/pages-action@v1- with:- apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}- accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}- projectName: ${{ env.CLOUDFLARE_PROJECT_NAME }}- directory: ./web-app/dist-web- branch: main- # Optional: Enable this if you want to have GitHub Deployments triggered- gitHubToken: ${{ secrets.GITHUB_TOKEN }}diff --git a/.github/workflows/jan-server-web-ci-stag.yml b/.github/workflows/jan-server-web-ci-stag.ymldeleted file mode 100644index b113bf30c..000000000--- a/.github/workflows/jan-server-web-ci-stag.yml+++ /dev/null@@ -1,61 +0,0 @@-name: Jan Web Server build image and push to Harbor Registry--on:- push:- branches:- - stag-web- pull_request:- branches:- - stag-web--jobs:- build-and-preview:- runs-on: [ubuntu-24-04-docker]- env:- JAN_BASE_URL: "https://api-stag.jan.ai/v1"- GA_MEASUREMENT_ID: "G-YK53MX8M8M"- permissions:- pull-requests: write- contents: write- steps:- - name: Checkout source repo- uses: actions/checkout@v4-- - name: Login to Harbor Registry- uses: docker/login-action@v3- with:- registry: registry.menlo.ai- username: ${{ secrets.HARBOR_USERNAME }}- password: ${{ secrets.HARBOR_PASSWORD }}-- - name: Install dependencies- run: |- (type -p wget >/dev/null || (sudo apt update && sudo apt install wget -y)) \- && sudo mkdir -p -m 755 /etc/apt/keyrings \- && out=$(mktemp) && wget -nv -O$out https://cli.github.com/packages/githubcli-archive-keyring.gpg \- && cat $out | sudo tee /etc/apt/keyrings/githubcli-archive-keyring.gpg > /dev/null \- && sudo chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg \- && sudo mkdir -p -m 755 /etc/apt/sources.list.d \- && echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \- && sudo apt update- sudo apt-get install -y jq gettext-- - name: Set image tag- id: vars- run: |- if [[ "${{ github.event_name }}" == "pull_request" ]]; then- IMAGE_TAG="web:preview-${{ github.sha }}"- else- IMAGE_TAG="web:stag-${{ github.sha }}"- fi- echo "IMAGE_TAG=${IMAGE_TAG}" >> $GITHUB_OUTPUT- echo "FULL_IMAGE=registry.menlo.ai/jan-server/${IMAGE_TAG}" >> $GITHUB_OUTPUT-- - name: Build docker image- run: |- docker build --build-arg JAN_BASE_URL=${{ env.JAN_BASE_URL }} --build-arg GA_MEASUREMENT_ID=${{ env.GA_MEASUREMENT_ID }} -t ${{ steps.vars.outputs.FULL_IMAGE }} .-- - name: Push docker image- if: github.event_name == 'push'- run: |- docker push ${{ steps.vars.outputs.FULL_IMAGE }}diff --git a/.github/workflows/jan-tauri-build-beta.yml b/.github/workflows/jan-tauri-build-beta.ymldeleted file mode 100644index 476293d71..000000000--- a/.github/workflows/jan-tauri-build-beta.yml+++ /dev/null@@ -1,156 +0,0 @@-name: Tauri Builder - Beta Build--on:- push:- tags: ["v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+-beta"]--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- generate_release_notes: true-- build-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- new_version: ${{ needs.get-update-version.outputs.new_version }}- channel: beta- cortex_api_port: "39271"- upload_url: ${{ needs.create-draft-release.outputs.upload_url }}-- build-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- new_version: ${{ needs.get-update-version.outputs.new_version }}- channel: beta- cortex_api_port: "39271"- upload_url: ${{ needs.create-draft-release.outputs.upload_url }}-- build-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- new_version: ${{ needs.get-update-version.outputs.new_version }}- channel: beta- cortex_api_port: "39271"- upload_url: ${{ needs.create-draft-release.outputs.upload_url }}-- sync-temp-to-latest:- needs: [create-draft-release, get-update-version, build-macos, build-windows-x64, build-linux-x64]- runs-on: ubuntu-latest- permissions:- contents: write- steps:- - name: Getting the repo- uses: actions/checkout@v3-- - 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-linux-x64.outputs.APPIMAGE_SIG }}"- LINUX_URL="https://delta.jan.ai/beta/${{ needs.build-linux-x64.outputs.APPIMAGE_FILE_NAME }}"- WINDOWS_SIGNATURE="${{ needs.build-windows-x64.outputs.WIN_SIG }}"- WINDOWS_URL="https://delta.jan.ai/beta/${{ needs.build-windows-x64.outputs.FILE_NAME }}"- DARWIN_SIGNATURE="${{ needs.build-macos.outputs.MAC_UNIVERSAL_SIG }}"- DARWIN_URL="https://delta.jan.ai/beta/Jan-beta_${{ 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- run: |- # sync temp-beta to beta by copy files that are different or new- aws s3 cp ./latest.json s3://${{ secrets.DELTA_AWS_S3_BUCKET_NAME }}/temp-beta/latest.json- aws s3 sync "s3://${{ secrets.DELTA_AWS_S3_BUCKET_NAME }}/temp-beta/" "s3://${{ secrets.DELTA_AWS_S3_BUCKET_NAME }}/beta/"- 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- env:- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}- uses: actions/[email protected]- with:- upload_url: ${{ needs.create-draft-release.outputs.upload_url }}- asset_path: ./latest.json- asset_name: latest.json- asset_content_type: text/json-- noti-discord-and-update-url-readme:- needs: [build-macos, get-update-version, build-windows-x64, build-linux-x64, sync-temp-to-latest]- runs-on: ubuntu-latest- steps:- - name: Set version to environment variable- run: |- VERSION=${{ needs.get-update-version.outputs.new_version }}- VERSION="${VERSION#v}"- echo "VERSION=$VERSION" >> $GITHUB_ENV-- - name: Notify Discord- uses: Ilshidur/action-discord@master- with:- args: |- Jan-beta App version {{ VERSION }}, has been released, use the following links to download the app with faster speed or visit the Github release page for more information:- - Windows: https://delta.jan.ai/beta/Jan-beta_{{ VERSION }}_x64-setup.exe- - macOS Universal: https://delta.jan.ai/beta/Jan-beta_{{ VERSION }}_universal.dmg- - Linux Deb: https://delta.jan.ai/beta/Jan-beta_{{ VERSION }}_amd64.deb- - Linux AppImage: https://delta.jan.ai/beta/Jan-beta_{{ VERSION }}_amd64.AppImage- env:- DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK_JAN_BETA }}\ No newline at end of filediff --git a/.github/workflows/jan-tauri-build-nightly-external.yaml b/.github/workflows/jan-tauri-build-nightly-external.yamlindex 167b4d223..719b8b9e1 100644--- a/.github/workflows/jan-tauri-build-nightly-external.yaml+++ b/.github/workflows/jan-tauri-build-nightly-external.yaml@@ -3,7 +3,7 @@ name: Tauri Builder - Nightly / External PRson:pull_request:branches:- - dev+ - mainpaths:- '.github/workflows/jan-tauri-build-nightly-external.yaml'- '.github/workflows/template-tauri-build-*-external.yml'diff --git a/.github/workflows/jan-tauri-build-nightly.yaml b/.github/workflows/jan-tauri-build-nightly.yamlindex 7cf5e828b..360881afc 100644--- a/.github/workflows/jan-tauri-build-nightly.yaml+++ b/.github/workflows/jan-tauri-build-nightly.yaml@@ -19,7 +19,7 @@ on:pull_request:branches:- release/**- - dev+ - mainpaths:- '.github/workflows/jan-tauri-build-nightly.yaml'- '.github/workflows/template-get-update-version.yml'@@ -54,7 +54,7 @@ jobs:elseif [ "${{ github.event_name }}" == "schedule" ]; thenecho "::set-output name=public_provider::aws-s3"- echo "::set-output name=ref::refs/heads/dev"+ echo "::set-output name=ref::refs/heads/main"elif [ "${{ github.event_name }}" == "push" ]; thenecho "::set-output name=public_provider::aws-s3"echo "::set-output name=ref::${{ github.ref }}"