chore: add ci for web stag (#6550)

This commit is contained in:
hiento09 2025-09-23 01:58:48 +07:00 committed by GitHub
parent bf7f176741
commit 05e58cffe8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 70 additions and 2 deletions

View File

@ -11,6 +11,8 @@ on:
jobs: jobs:
build-and-preview: build-and-preview:
runs-on: [ubuntu-24-04-docker] runs-on: [ubuntu-24-04-docker]
env:
JAN_API_BASE: "https://api-dev.jan.ai/v1"
permissions: permissions:
pull-requests: write pull-requests: write
contents: write contents: write
@ -50,7 +52,7 @@ jobs:
- name: Build docker image - name: Build docker image
run: | run: |
docker build -t ${{ steps.vars.outputs.FULL_IMAGE }} . docker build --build-arg JAN_API_BASE=${{ env.JAN_API_BASE }} -t ${{ steps.vars.outputs.FULL_IMAGE }} .
- name: Push docker image - name: Push docker image
if: github.event_name == 'push' if: github.event_name == 'push'

View File

@ -13,7 +13,7 @@ jobs:
deployments: write deployments: write
pull-requests: write pull-requests: write
env: env:
JAN_API_BASE: "https://api.jan.ai/jan/v1" JAN_API_BASE: "https://api.jan.ai/v1"
GA_MEASUREMENT_ID: "G-YK53MX8M8M" GA_MEASUREMENT_ID: "G-YK53MX8M8M"
CLOUDFLARE_PROJECT_NAME: "jan-server-web" CLOUDFLARE_PROJECT_NAME: "jan-server-web"
steps: steps:
@ -42,6 +42,9 @@ jobs:
- name: Install dependencies - name: Install dependencies
run: make config-yarn && yarn install && yarn build:core && make build-web-app run: make config-yarn && yarn install && yarn build:core && make build-web-app
env:
JAN_API_BASE: ${{ env.JAN_API_BASE }}
GA_MEASUREMENT_ID: ${{ env.GA_MEASUREMENT_ID }}
- name: Publish to Cloudflare Pages Production - name: Publish to Cloudflare Pages Production
uses: cloudflare/pages-action@v1 uses: cloudflare/pages-action@v1

View File

@ -0,0 +1,60 @@
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_API_BASE: "https://api-stag.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: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_API_BASE=${{ env.JAN_API_BASE }} -t ${{ steps.vars.outputs.FULL_IMAGE }} .
- name: Push docker image
if: github.event_name == 'push'
run: |
docker push ${{ steps.vars.outputs.FULL_IMAGE }}

View File

@ -1,6 +1,9 @@
# Stage 1: Build stage with Node.js and Yarn v4 # Stage 1: Build stage with Node.js and Yarn v4
FROM node:20-alpine AS builder FROM node:20-alpine AS builder
ARG JAN_API_BASE=https://api-dev.jan.ai/v1
ENV JAN_API_BASE=$JAN_API_BASE
# Install build dependencies # Install build dependencies
RUN apk add --no-cache \ RUN apk add --no-cache \
make \ make \