aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDhravya <[email protected]>2024-03-31 15:40:49 -0700
committerDhravya <[email protected]>2024-03-31 15:40:49 -0700
commit4e1cc8a52fc457f05e908eeae30b309461d8072b (patch)
tree5f09b86796b9b9012dddf32dd44ef7e65055c9a9
parent(ci): conditionally build and deploy (diff)
downloadsupermemory-4e1cc8a52fc457f05e908eeae30b309461d8072b.tar.xz
supermemory-4e1cc8a52fc457f05e908eeae30b309461d8072b.zip
added workflow to auto deploy workers
-rw-r--r--.github/workflows/build.yml18
-rw-r--r--apps/cf-ai-backend/.gitignore1
-rw-r--r--apps/cf-ai-backend/wrangler.toml59
3 files changed, 77 insertions, 1 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 653bb11e..ab8ae98f 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -50,9 +50,27 @@ jobs:
- name: Publish to Cloudflare Pages
uses: cloudflare/pages-action@v1
+ if: github.event_name == 'push' && github.ref == 'refs/heads/main'
with:
apiToken: ${{ secrets.CF_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
projectName: ${{ secrets.CLOUDFLARE_PROJECT_NAME }}
directory: apps/web/.vercel/output/static
branch: main
+
+ deploy-cf-worker:
+ if: contains(github.event.head_commit.modified, 'apps/cf-ai-backend/') || contains(github.event.head_commit.added, 'apps/cf-ai-backend/') || contains(github.event.head_commit.removed, 'apps/cf-ai-backend/')
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout repo
+ uses: actions/checkout@v3
+
+ - name: Deploy to Cloudflare Workers
+ uses: cloudflare/[email protected]
+ with:
+ apiToken: ${{ secrets.CF_API_TOKEN }}
+ script: wrangler publish
+ working-directory: apps/cf-ai-backend
+ env:
+ OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
+ SECURITY_KEY: ${{ secrets.BACKEND_SECURITY_KEY }} \ No newline at end of file
diff --git a/apps/cf-ai-backend/.gitignore b/apps/cf-ai-backend/.gitignore
index c51412d9..3b0fe33c 100644
--- a/apps/cf-ai-backend/.gitignore
+++ b/apps/cf-ai-backend/.gitignore
@@ -1,5 +1,4 @@
# Logs
-wrangler.toml
logs
_.log
diff --git a/apps/cf-ai-backend/wrangler.toml b/apps/cf-ai-backend/wrangler.toml
new file mode 100644
index 00000000..ce7b0222
--- /dev/null
+++ b/apps/cf-ai-backend/wrangler.toml
@@ -0,0 +1,59 @@
+name = "cf-ai-backend"
+main = "src/index.ts"
+compatibility_date = "2024-02-23"
+
+[[vectorize]]
+binding = "VECTORIZE_INDEX"
+index_name = "any-vector"
+
+[ai]
+binding = "AI"
+
+
+# Variable bindings. These are arbitrary, plaintext strings (similar to environment variables)
+# Note: Use secrets to store sensitive data.
+# Docs: https://developers.cloudflare.com/workers/platform/environment-variables
+# [vars]
+# MY_VARIABLE = "production_value"
+
+# Bind a KV Namespace. Use KV as persistent storage for small key-value pairs.
+# Docs: https://developers.cloudflare.com/workers/runtime-apis/kv
+# [[kv_namespaces]]
+# binding = "MY_KV_NAMESPACE"
+# id = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
+
+# Bind an R2 Bucket. Use R2 to store arbitrarily large blobs of data, such as files.
+# Docs: https://developers.cloudflare.com/r2/api/workers/workers-api-usage/
+# [[r2_buckets]]
+# binding = "MY_BUCKET"
+# bucket_name = "my-bucket"
+
+# Bind a Queue producer. Use this binding to schedule an arbitrary task that may be processed later by a Queue consumer.
+# Docs: https://developers.cloudflare.com/queues/get-started
+# [[queues.producers]]
+# binding = "MY_QUEUE"
+# queue = "my-queue"
+
+# Bind a Queue consumer. Queue Consumers can retrieve tasks scheduled by Producers to act on them.
+# Docs: https://developers.cloudflare.com/queues/get-started
+# [[queues.consumers]]
+# queue = "my-queue"
+
+# Bind another Worker service. Use this binding to call another Worker without network overhead.
+# Docs: https://developers.cloudflare.com/workers/platform/services
+# [[services]]
+# binding = "MY_SERVICE"
+# service = "my-service"
+
+# Bind a Durable Object. Durable objects are a scale-to-zero compute primitive based on the actor model.
+# Durable Objects can live for as long as needed. Use these when you need a long-running "server", such as in realtime apps.
+# Docs: https://developers.cloudflare.com/workers/runtime-apis/durable-objects
+# [[durable_objects.bindings]]
+# name = "MY_DURABLE_OBJECT"
+# class_name = "MyDurableObject"
+
+# Durable Object migrations.
+# Docs: https://developers.cloudflare.com/workers/learning/using-durable-objects#configure-durable-object-classes-with-migrations
+# [[migrations]]
+# tag = "v1"
+# new_classes = ["MyDurableObject"]