From fcc53f5d68e18eeb84a02f02cb3bc87bb1b7fd39 Mon Sep 17 00:00:00 2001 From: Keavon Chambers Date: Wed, 18 Mar 2026 23:08:30 -0700 Subject: [PATCH 1/2] Consolidate CI web builds into the build workflow and restore deployments to GitHub environments Restore the CI "View deployment" button in PRs after building Consolidate release.yml functionality into build.yml Move build from ci.yml to a delegated run in build.yml --- .github/workflows/build.yml | 95 +++++++++++++++++++++++++++++------ .github/workflows/ci.yml | 77 ++-------------------------- .github/workflows/release.yml | 72 -------------------------- 3 files changed, 85 insertions(+), 159 deletions(-) delete mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 58467c78ec..40f17065aa 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,6 +4,8 @@ on: push: branches: - master + tags: + - latest-stable workflow_dispatch: inputs: web: @@ -59,8 +61,6 @@ jobs: RUSTC_WRAPPER: /usr/bin/sccache CARGO_INCREMENTAL: 0 SCCACHE_DIR: /var/lib/github-actions/.cache - INDEX_HTML_HEAD_REPLACEMENT: - steps: - name: πŸ“₯ Clone repository uses: actions/checkout@v6 @@ -90,9 +90,22 @@ jobs: rustflags: "" target: wasm32-unknown-unknown + - name: πŸ”€ Choose production deployment environment + id: production-env + if: github.event_name == 'push' + run: | + if [[ "${{ github.ref }}" == "refs/tags/latest-stable" ]]; then + echo "cf_project=graphite-editor" >> $GITHUB_OUTPUT + DOMAIN="editor.graphite.art" + else + echo "cf_project=graphite-dev" >> $GITHUB_OUTPUT + DOMAIN="dev.graphite.art" + fi + echo "head_replacement=" >> $GITHUB_OUTPUT + - name: βœ‚ Replace template in of index.html if: github.event_name == 'push' - run: sed -i "s||$INDEX_HTML_HEAD_REPLACEMENT|" frontend/index.html + run: sed -i "s||${{ steps.production-env.outputs.head_replacement }}|" frontend/index.html - name: 🌐 Build Graphite web code env: @@ -105,11 +118,15 @@ jobs: CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} run: | + if [ -z "$CLOUDFLARE_API_TOKEN" ]; then + echo "No Cloudflare API token available (fork PR), skipping deploy." + exit 0 + fi MAX_ATTEMPTS=5 DELAY=30 for ATTEMPT in $(seq 1 $MAX_ATTEMPTS); do echo "Attempt $ATTEMPT of $MAX_ATTEMPTS..." - if OUTPUT=$(npx wrangler@3 pages deploy "frontend/dist" --project-name="graphite-dev" --commit-dirty=true 2>&1); then + if OUTPUT=$(npx wrangler@3 pages deploy "frontend/dist" --project-name="${{ steps.production-env.outputs.cf_project }}" --commit-dirty=true 2>&1); then URL=$(echo "$OUTPUT" | grep -oP 'https://[^\s]+\.pages\.dev' | head -1) echo "url=$URL" >> "$GITHUB_OUTPUT" echo "Published successfully: $URL" @@ -126,6 +143,43 @@ jobs: echo "All $MAX_ATTEMPTS Cloudflare Pages publish attempts failed." exit 1 + - name: πŸš€ Create GitHub Deployment for "View deployment" button + if: inputs.checkout_repo == '' || inputs.checkout_repo == github.repository + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + CF_URL: ${{ steps.cloudflare.outputs.url }} + run: | + if [ -z "$CF_URL" ]; then + echo "No Cloudflare URL available, skipping deployment." + exit 0 + fi + if [ "${{ github.ref }}" = "refs/tags/latest-stable" ]; then + REF="latest-stable" + ENVIRONMENT="graphite-editor (Production)" + elif [ "${{ github.event_name }}" = "push" ]; then + REF="master" + ENVIRONMENT="graphite-dev (Production)" + else + REF="${{ inputs.checkout_ref || github.head_ref || github.ref_name }}" + ENVIRONMENT="graphite-dev (Preview)" + fi + DEPLOY_ID=$(gh api \ + -X POST \ + -H "Accept: application/vnd.github+json" \ + repos/${{ github.repository }}/deployments \ + --input - \ + --jq '.id' < - - steps: - - name: πŸ“₯ Clone repository - uses: actions/checkout@v6 - - - name: πŸ—‘ Clear wasm-bindgen cache - run: rm -r ~/.cache/.wasm-pack - - - name: 🟒 Install Node.js - uses: actions/setup-node@v6 - with: - node-version-file: .nvmrc - - - name: 🚧 Install build dependencies - run: | - cd frontend - npm run setup - - - name: πŸ¦€ Install Rust - uses: actions-rust-lang/setup-rust-toolchain@v1 - with: - toolchain: stable - override: true - cache: false - rustflags: "" - target: wasm32-unknown-unknown - - - name: βœ‚ Replace template in of index.html - run: sed -i "s||$INDEX_HTML_HEAD_REPLACEMENT|" frontend/index.html - - - name: 🌐 Build Graphite web code - env: - NODE_ENV: production - run: mold -run cargo run build web - - - name: πŸ“€ Publish to Cloudflare Pages - env: - CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} - CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} - run: npx wrangler@3 pages deploy "frontend/dist" --project-name="graphite-editor" --branch="master" --commit-dirty=true - - - name: πŸ“¦ Upload assets to GitHub release - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - DATE=$(git log -1 --format=%cd --date=format:%Y-%m-%d) - cd frontend - sed -i "s|$INDEX_HTML_HEAD_REPLACEMENT||" dist/index.html - mv dist "graphite-$DATE" - zip -r "graphite-self-hosted-build.zip" "graphite-$DATE" - gh release upload latest-stable "graphite-self-hosted-build.zip" --clobber From 52ca52727f6ad04457bee757ccc56aa13fb86f5c Mon Sep 17 00:00:00 2001 From: afrdbaig7 Date: Thu, 19 Mar 2026 15:48:49 +0530 Subject: [PATCH 2/2] Fix increment number field drag jump at start --- .../widgets/inputs/NumberInput.svelte | 61 ++++++++++++------- 1 file changed, 39 insertions(+), 22 deletions(-) diff --git a/frontend/src/components/widgets/inputs/NumberInput.svelte b/frontend/src/components/widgets/inputs/NumberInput.svelte index 3f5a71d74f..a78333f0d4 100644 --- a/frontend/src/components/widgets/inputs/NumberInput.svelte +++ b/frontend/src/components/widgets/inputs/NumberInput.svelte @@ -1,11 +1,11 @@