From dbaf563e88f8c40e08f12230b3903228f26d9099 Mon Sep 17 00:00:00 2001 From: hiento09 <136591877+hiento09@users.noreply.github.com> Date: Tue, 9 Sep 2025 12:13:37 +0700 Subject: [PATCH] chore: add cicd for jan web prod (#6396) --- .../workflows/jan-server-web-cicd-prod.yml | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 .github/workflows/jan-server-web-cicd-prod.yml 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/install-jq-action@v2.0.1 + + # - 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 }}