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: add cicd for jan web prod (#6396)

hiento09dbaf563e88f8
diff --git a/.github/workflows/jan-server-web-cicd-prod.yml b/.github/workflows/jan-server-web-cicd-prod.yml
new file mode 100644
index 000000000..ad4f0698c
--- /dev/null
+++ b/.github/workflows/jan-server-web-cicd-prod.yml
@@ -0,0 +1,53 @@
+name: Jan Web Server deploy to production
+
+on:
+ push:
+ tags: ["v[0-9]+.[0-9]+.[0-9]+-web"]
+
+jobs:
+ build-and-deploy:
+ runs-on: ubuntu-latest
+ permissions:
+ contents: write
+ deployments: write
+ pull-requests: write
+ env:
+ JAN_API_BASE: "https://api.jan.ai"
+ 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
+
+ - 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 }}