From d441189a71fe983ccf894219c9bcd828cef65366 Mon Sep 17 00:00:00 2001 From: jorge Date: Wed, 11 Feb 2026 18:57:50 +0100 Subject: [PATCH 01/15] docs: add local development instructions - Add prerequisites section (Bun) - Add installation and development commands - Add build instructions for production --- README.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/README.md b/README.md index 39a6298..9c7cab6 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,34 @@ +## Development + +### Prerequisites + +- [Bun](https://bun.sh) installed on your system + +### Local Development + +```bash +# Clone the repository +git clone https://github.com/jorgefl8/codeink.git +cd codeink + +# Install dependencies +bun install + +# Start development server +bun dev +``` + +The development server will start at `http://localhost:4321` + +### Build for Production + +```bash +bun run build +``` + ## License This project is licensed under the MIT License. See the [LICENSE](https://github.com/jorgeifl8/codeink/blob/main/LICENSE) file for details. \ No newline at end of file From 9facd4726724e98dae25b37c430a202ebd9d0da3 Mon Sep 17 00:00:00 2001 From: jorge Date: Wed, 11 Feb 2026 19:00:22 +0100 Subject: [PATCH 02/15] fix: improve deployment workflow with debugging - Add verification step for build output - Simplify deploy command for better reliability - Show dist folder contents for debugging --- .github/workflows/deploy.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 903754a..3c4ae04 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -28,13 +28,18 @@ jobs: - name: Build run: bun run build + - name: Verify build output + run: | + echo "Build output contents:" + ls -la dist/ || echo "dist folder not found!" + - name: Deploy to Cloudflare Pages uses: cloudflare/wrangler-action@v3 id: cloudflare with: apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} - command: pages deploy dist --project-name=codeink ${{ github.event_name == 'release' && '--branch=main' || '' }} + command: pages deploy dist --project-name=codeink --branch=main gitHubToken: ${{ secrets.GITHUB_TOKEN }} - name: Comment PR From 8fc8cbb989fd5e80a46ea12810a6986cd8aa6d01 Mon Sep 17 00:00:00 2001 From: jorge Date: Wed, 11 Feb 2026 19:07:43 +0100 Subject: [PATCH 03/15] fix: add commit-dirty flag to wrangler deploy - Add --commit-dirty=true flag to suppress git warnings - Ensure deployment works with uncommitted changes in CI --- .github/workflows/deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 3c4ae04..cac566d 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -39,7 +39,7 @@ jobs: with: apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} - command: pages deploy dist --project-name=codeink --branch=main + command: pages deploy dist --project-name=codeink --commit-dirty=true gitHubToken: ${{ secrets.GITHUB_TOKEN }} - name: Comment PR From 88b342968cb61081e284bb7d033d29caf0d70104 Mon Sep 17 00:00:00 2001 From: jorge Date: Wed, 11 Feb 2026 19:11:44 +0100 Subject: [PATCH 04/15] fix: add wrangler.toml and use deploy command - Add wrangler.toml configuration file - Change from 'pages deploy' to 'deploy' command - Configure for Workers deployment with static assets --- .github/workflows/deploy.yml | 4 ++-- wrangler.toml | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 wrangler.toml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index cac566d..9e7d004 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -33,13 +33,13 @@ jobs: echo "Build output contents:" ls -la dist/ || echo "dist folder not found!" - - name: Deploy to Cloudflare Pages + - name: Deploy to Cloudflare uses: cloudflare/wrangler-action@v3 id: cloudflare with: apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} - command: pages deploy dist --project-name=codeink --commit-dirty=true + command: deploy gitHubToken: ${{ secrets.GITHUB_TOKEN }} - name: Comment PR diff --git a/wrangler.toml b/wrangler.toml new file mode 100644 index 0000000..955878f --- /dev/null +++ b/wrangler.toml @@ -0,0 +1,5 @@ +name = "codeink" +compatibility_date = "2024-01-01" + +[site] +bucket = "./dist" From 49150fb3c001e161cac3e1987e7baa75d18d1d50 Mon Sep 17 00:00:00 2001 From: jorge Date: Wed, 11 Feb 2026 19:15:35 +0100 Subject: [PATCH 05/15] fix: update wrangler.toml for Pages with correct format - Replace deprecated [site] configuration with pages_build_output_dir - Update compatibility_date to current date - Use 'pages deploy' command instead of 'deploy' - Follow official Cloudflare Pages documentation --- .github/workflows/deploy.yml | 4 ++-- wrangler.toml | 6 ++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 9e7d004..7f4f701 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -33,13 +33,13 @@ jobs: echo "Build output contents:" ls -la dist/ || echo "dist folder not found!" - - name: Deploy to Cloudflare + - name: Deploy to Cloudflare Pages uses: cloudflare/wrangler-action@v3 id: cloudflare with: apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} - command: deploy + command: pages deploy gitHubToken: ${{ secrets.GITHUB_TOKEN }} - name: Comment PR diff --git a/wrangler.toml b/wrangler.toml index 955878f..639a2b4 100644 --- a/wrangler.toml +++ b/wrangler.toml @@ -1,5 +1,3 @@ name = "codeink" -compatibility_date = "2024-01-01" - -[site] -bucket = "./dist" +compatibility_date = "2026-02-11" +pages_build_output_dir = "./dist" From 2a2dc5d7d8ddcc21bd4075623869b819996ce526 Mon Sep 17 00:00:00 2001 From: jorge Date: Wed, 11 Feb 2026 19:16:23 +0100 Subject: [PATCH 06/15] chore: remove explicit compatibility date from wrangler.toml - Let Wrangler use the latest compatibility date automatically - Simplifies configuration file --- wrangler.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/wrangler.toml b/wrangler.toml index 639a2b4..3641786 100644 --- a/wrangler.toml +++ b/wrangler.toml @@ -1,3 +1,2 @@ name = "codeink" -compatibility_date = "2026-02-11" pages_build_output_dir = "./dist" From 2f07c700d02b83987fffe7627b026e53b074dde5 Mon Sep 17 00:00:00 2001 From: jorge Date: Wed, 11 Feb 2026 19:20:22 +0100 Subject: [PATCH 07/15] fix: configure for Cloudflare Workers instead of Pages - Change from Pages to Workers configuration format - Use [assets] directory instead of pages_build_output_dir - Use wrangler deploy command instead of pages deploy - Add compatibility_date (required for Workers) - Update workflow step names and comments --- .github/workflows/deploy.yml | 14 +++++++------- wrangler.toml | 5 ++++- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 7f4f701..5a0758f 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -33,13 +33,13 @@ jobs: echo "Build output contents:" ls -la dist/ || echo "dist folder not found!" - - name: Deploy to Cloudflare Pages + - name: Deploy to Cloudflare Workers uses: cloudflare/wrangler-action@v3 - id: cloudflare + id: cloudflare with: apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} - command: pages deploy + command: deploy gitHubToken: ${{ secrets.GITHUB_TOKEN }} - name: Comment PR @@ -49,14 +49,14 @@ jobs: script: | const url = '${{ steps.cloudflare.outputs.deployment-url }}'; const alias = '${{ steps.cloudflare.outputs.pages-deployment-alias-url }}'; - - const body = `### Cloudflare pages deployed! - + + const body = `### Cloudflare Workers deployed! + | Name | Link | | :--- | :--- | | **Preview URL** | [${url}](${url}) | | **Branch Alias** | [${alias}](${alias}) | - + *Commit: ${context.sha}*`; github.rest.issues.createComment({ diff --git a/wrangler.toml b/wrangler.toml index 3641786..6d72959 100644 --- a/wrangler.toml +++ b/wrangler.toml @@ -1,2 +1,5 @@ name = "codeink" -pages_build_output_dir = "./dist" +compatibility_date = "2026-02-11" + +[assets] +directory = "./dist" From 7604999b008d89aaa28630736fa2ef6772928e6b Mon Sep 17 00:00:00 2001 From: jorge Date: Wed, 11 Feb 2026 19:23:37 +0100 Subject: [PATCH 08/15] feat: enable preview URLs for Workers - Add preview_urls = true to wrangler.toml - Allows accessing preview versions of the Worker --- wrangler.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/wrangler.toml b/wrangler.toml index 6d72959..3700cfb 100644 --- a/wrangler.toml +++ b/wrangler.toml @@ -1,5 +1,6 @@ name = "codeink" compatibility_date = "2026-02-11" +preview_urls = true [assets] directory = "./dist" From 575c71d913a61d9463b61ba19eee061378cf2c5f Mon Sep 17 00:00:00 2001 From: jorge Date: Wed, 11 Feb 2026 19:25:20 +0100 Subject: [PATCH 09/15] feat: deploy to preview environment for PRs - Use --preview flag when deploying from pull requests - Deploy to production on releases - Allows testing changes before merging to main --- .github/workflows/deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 5a0758f..5591bcd 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -39,7 +39,7 @@ jobs: with: apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} - command: deploy + command: ${{ github.event_name == 'pull_request' && 'deploy --preview' || 'deploy' }} gitHubToken: ${{ secrets.GITHUB_TOKEN }} - name: Comment PR From 23e686630db6de2b46710a9cf94681bcce172644 Mon Sep 17 00:00:00 2001 From: jorge Date: Wed, 11 Feb 2026 19:25:59 +0100 Subject: [PATCH 10/15] fix: improve PR comment for Workers deployments - Remove Branch Alias field (not available in Workers) - Add branch name display for context - Update comment title to show Preview/Production - Clean up formatting --- .github/workflows/deploy.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 5591bcd..574c526 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -48,14 +48,16 @@ jobs: with: script: | const url = '${{ steps.cloudflare.outputs.deployment-url }}'; - const alias = '${{ steps.cloudflare.outputs.pages-deployment-alias-url }}'; + const branch = context.payload.pull_request.head.ref; + const isPreview = '${{ github.event_name == 'pull_request' }}' === 'true'; + const environment = isPreview ? 'Preview' : 'Production'; - const body = `### Cloudflare Workers deployed! + const body = `### 🚀 Cloudflare Workers ${environment} Deployment | Name | Link | | :--- | :--- | - | **Preview URL** | [${url}](${url}) | - | **Branch Alias** | [${alias}](${alias}) | + | **${environment} URL** | [${url}](${url}) | + | **Branch** | \`${branch}\` | *Commit: ${context.sha}*`; From cc2a9cfb9a2d30450a8ac8f8ae554615668d9301 Mon Sep 17 00:00:00 2001 From: jorge Date: Wed, 11 Feb 2026 19:29:10 +0100 Subject: [PATCH 11/15] fix: correct workflow name and remove invalid preview flag - Change workflow name from Pages to Workers - Remove --preview flag (not valid for wrangler deploy) - Use simple deploy command with preview_urls enabled in wrangler.toml --- .github/workflows/deploy.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 574c526..e215fbf 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,4 +1,4 @@ -name: Deploy to Cloudflare Pages +name: Deploy to Cloudflare Workers on: release: @@ -39,7 +39,7 @@ jobs: with: apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} - command: ${{ github.event_name == 'pull_request' && 'deploy --preview' || 'deploy' }} + command: deploy gitHubToken: ${{ secrets.GITHUB_TOKEN }} - name: Comment PR From 896b678e2d0a3f45d557f1132d14cc4c4ef4182a Mon Sep 17 00:00:00 2001 From: jorge Date: Wed, 11 Feb 2026 19:32:54 +0100 Subject: [PATCH 12/15] fix: use versions upload for PR previews to avoid affecting production - Production releases use 'deploy' command (affects production) - PRs use 'versions upload --preview-alias ' for preview URLs - Preview URLs follow pattern: -codeink.jorgeflorentinomarbe.workers.dev - Fixes issue where PRs were deploying directly to production URL --- .github/workflows/deploy.yml | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index e215fbf..0adfebe 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -33,7 +33,8 @@ jobs: echo "Build output contents:" ls -la dist/ || echo "dist folder not found!" - - name: Deploy to Cloudflare Workers + - name: Deploy to Production + if: github.event_name == 'release' uses: cloudflare/wrangler-action@v3 id: cloudflare with: @@ -42,28 +43,36 @@ jobs: command: deploy gitHubToken: ${{ secrets.GITHUB_TOKEN }} + - name: Upload Preview Version + if: github.event_name == 'pull_request' + uses: cloudflare/wrangler-action@v3 + id: cloudflare + with: + apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} + accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} + command: versions upload --preview-alias ${{ github.head_ref }} + gitHubToken: ${{ secrets.GITHUB_TOKEN }} + - name: Comment PR if: github.event_name == 'pull_request' uses: actions/github-script@v6 with: script: | - const url = '${{ steps.cloudflare.outputs.deployment-url }}'; const branch = context.payload.pull_request.head.ref; - const isPreview = '${{ github.event_name == 'pull_request' }}' === 'true'; - const environment = isPreview ? 'Preview' : 'Production'; + const previewUrl = `https://${branch}-codeink.jorgeflorentinomarbe.workers.dev`; - const body = `### 🚀 Cloudflare Workers ${environment} Deployment + const body = `### 🚀 Cloudflare Workers Preview Deployment | Name | Link | | :--- | :--- | - | **${environment} URL** | [${url}](${url}) | + | **Preview URL** | [${previewUrl}](${previewUrl}) | | **Branch** | \`${branch}\` | - *Commit: ${context.sha}*`; + *Commit: ${context.sha}*\n\n> Note: Preview deployments create a version without affecting production. The URL follows the pattern: \`-codeink.jorgeflorentinomarbe.workers.dev\``; github.rest.issues.createComment({ issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, body: body - }) \ No newline at end of file + }) From 9fa24376e16865e8090c8fdc2b0f00c27dbc5a67 Mon Sep 17 00:00:00 2001 From: jorge Date: Wed, 11 Feb 2026 19:39:03 +0100 Subject: [PATCH 13/15] fix: add explicit PR event types and unique step IDs - Add types: [opened, synchronize, reopened] to pull_request trigger - Add workflow_dispatch for manual execution - Fix duplicate step IDs (deploy-prod and deploy-preview) - Remove trailing whitespace --- .github/workflows/deploy.yml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 0adfebe..3590799 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -5,6 +5,8 @@ on: types: [published] pull_request: branches: [main] + types: [opened, synchronize, reopened] + workflow_dispatch: jobs: deploy: @@ -12,7 +14,7 @@ jobs: permissions: contents: read deployments: write - pull-requests: write + pull-requests: write steps: - name: Checkout uses: actions/checkout@v4 @@ -36,7 +38,7 @@ jobs: - name: Deploy to Production if: github.event_name == 'release' uses: cloudflare/wrangler-action@v3 - id: cloudflare + id: deploy-prod with: apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} @@ -46,7 +48,7 @@ jobs: - name: Upload Preview Version if: github.event_name == 'pull_request' uses: cloudflare/wrangler-action@v3 - id: cloudflare + id: deploy-preview with: apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} @@ -68,7 +70,9 @@ jobs: | **Preview URL** | [${previewUrl}](${previewUrl}) | | **Branch** | \`${branch}\` | - *Commit: ${context.sha}*\n\n> Note: Preview deployments create a version without affecting production. The URL follows the pattern: \`-codeink.jorgeflorentinomarbe.workers.dev\``; + *Commit: ${context.sha}* + + > Note: Preview deployments create a version without affecting production. The URL follows the pattern: \`-codeink.jorgeflorentinomarbe.workers.dev\``; github.rest.issues.createComment({ issue_number: context.issue.number, From 773942445281801ba10fdc5e6c28885d01acd6ec Mon Sep 17 00:00:00 2001 From: jorge Date: Wed, 11 Feb 2026 19:40:53 +0100 Subject: [PATCH 14/15] fix: use --tag instead of --preview-alias for versions upload - --preview-alias requires wrangler v4.21.0+, we have v3.90.0 - --tag is available in current version and creates similar alias - Preview URL follows same pattern: -codeink.jorgeflorentinomarbe.workers.dev --- .github/workflows/deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 3590799..7a3d472 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -52,7 +52,7 @@ jobs: with: apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} - command: versions upload --preview-alias ${{ github.head_ref }} + command: versions upload --tag ${{ github.head_ref }} gitHubToken: ${{ secrets.GITHUB_TOKEN }} - name: Comment PR From ec4ef0623b2b5326a33d930c807e6d24b3488b04 Mon Sep 17 00:00:00 2001 From: jorge Date: Wed, 11 Feb 2026 19:44:24 +0100 Subject: [PATCH 15/15] fix: include assets in versions upload for preview deployments - Add --assets ./dist flag to include static assets - Fixes 'There is nothing here yet' error on preview URLs --- .github/workflows/deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 7a3d472..6b69fc5 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -52,7 +52,7 @@ jobs: with: apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} - command: versions upload --tag ${{ github.head_ref }} + command: versions upload --tag ${{ github.head_ref }} --assets ./dist gitHubToken: ${{ secrets.GITHUB_TOKEN }} - name: Comment PR