59 lines
1.8 KiB
YAML
59 lines
1.8 KiB
YAML
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_API_BASE: "https://api.menlo.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/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
|
|
env:
|
|
JAN_API_BASE: ${{ env.JAN_API_BASE }}
|
|
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 }}
|