Skip to content

Commit

Permalink
Merge pull request #36 from ubiquity-os-marketplace/development
Browse files Browse the repository at this point in the history
Merge development into main
  • Loading branch information
gentlementlegen authored Jan 27, 2025
2 parents 6a73940 + a8a56db commit 9c3663f
Show file tree
Hide file tree
Showing 14 changed files with 2,485 additions and 61 deletions.
2 changes: 1 addition & 1 deletion .github/knip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const config: KnipConfig = {
ignore: ["**/__mocks__/**", "**/__fixtures__/**", "src/types/database.ts"],
ignoreExportsUsedInFile: true,
// eslint can also be safely ignored as per the docs: https://knip.dev/guides/handling-issues#eslint--jest
ignoreDependencies: ["eslint-config-prettier", "eslint-plugin-prettier", "@mswjs/data", "ts-node", "hono"],
ignoreDependencies: ["eslint-config-prettier", "eslint-plugin-prettier", "ts-node", "hono", "dotenv"],
eslint: true,
};

Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/update-configuration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ jobs:
permissions: write-all

steps:
- uses: ubiquity-os/action-deploy-plugin@main
- name: Update Manifest and Commit Changes
uses: ubiquity-os/action-deploy-plugin@main
with:
treatAsEsm: false
sourcemap: false
Expand Down
11 changes: 3 additions & 8 deletions .github/workflows/worker-delete.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,16 @@ jobs:
delete:
runs-on: ubuntu-latest
name: Delete Deployment
environment: ${{ (github.ref == 'refs/heads/main' || github.event.workflow_run.head_branch == 'main') && 'main' || 'development' }}
steps:
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "20.10.0"

- name: Enable corepack
run: corepack enable
- uses: oven-sh/setup-bun@v2

- uses: actions/checkout@v4

- name: Get Deleted Branch Name
id: get_branch
run: |
branch_name=$(echo '${{ github.event.ref }}' | sed 's#refs/heads/##' | sed 's#[^a-zA-Z0-9]#-#g')
branch_name=$(echo '${{ github.event.workflow_run.head_branch || github.ref }}' | sed 's#refs/heads/##' | sed 's#[^a-zA-Z0-9]#-#g')
echo "branch_name=$branch_name" >> $GITHUB_ENV
- name: Retrieve and Construct Full Worker Name
id: construct_worker_name
Expand Down
23 changes: 6 additions & 17 deletions .github/workflows/worker-deploy.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name: Deploy Worker

on:
workflow_dispatch:
workflow_run:
workflows: ["Update Configuration and Build"]
types:
- completed
workflow_dispatch:

env:
APP_ID: ${{ secrets.APP_ID }}
Expand All @@ -15,24 +15,18 @@ jobs:
deploy-to-cloudflare:
runs-on: ubuntu-latest
name: Automatic Cloudflare Deploy
environment: ${{ github.ref == 'refs/heads/main' && 'main' || 'development' }}
environment: ${{ (github.ref == 'refs/heads/main' || github.event.workflow_run.head_branch == 'main') && 'main' || 'development' }}
permissions:
contents: write

steps:
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "20.10.0"
- uses: oven-sh/setup-bun@v2

- uses: actions/checkout@v4

- name: Setup Bun
uses: oven-sh/setup-bun@v2

- name: Update wrangler.toml Name Field
run: |
branch_name=$(echo '${{ github.ref }}' | sed 's#refs/heads/##' | sed 's#[^a-zA-Z0-9]#-#g')
branch_name=$(echo '${{ github.event.workflow_run.head_branch || github.ref }}' | sed 's#refs/heads/##' | sed 's#[^a-zA-Z0-9]#-#g')
# Extract base name from wrangler.toml
base_name=$(grep '^name = ' wrangler.toml | sed 's/^name = "\(.*\)"$/\1/')
# Concatenate branch name with base name
Expand All @@ -47,20 +41,18 @@ jobs:
id: wrangler_deploy
uses: cloudflare/wrangler-action@v3
with:
wranglerVersion: "3.87.0"
wranglerVersion: "3.105.0"
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
secrets: |
SUPABASE_URL
SUPABASE_KEY
CLOUDFLARE_ACCOUNT_ID
CLOUDFLARE_API_TOKEN
${{ secrets.KERNEL_PUBLIC_KEY && secrets.KERNEL_PUBLIC_KEY != '' && 'KERNEL_PUBLIC_KEY' || '' }}
env:
SUPABASE_URL: ${{ secrets.SUPABASE_URL }}
SUPABASE_KEY: ${{ secrets.SUPABASE_KEY }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
KERNEL_PUBLIC_KEY: ${{ secrets.KERNEL_PUBLIC_KEY }}

- name: Update manifest.json worker url
Expand All @@ -69,12 +61,9 @@ jobs:
script: |
const fs = require('fs');
const path = require('path');
const manifestPath = path.resolve("${{ github.workspace }}", './manifest.json');
const manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf8'));
manifest["homepage_url"] = "${{ steps.wrangler_deploy.outputs.deployment-url }}";
const updatedManifest = JSON.stringify(manifest, null, 2);
fs.writeFileSync(manifestPath, updatedManifest);
console.log('Updated manifest:', updatedManifest);
Expand All @@ -101,7 +90,7 @@ jobs:
files: |
manifest.json
commit-message: "chore: [skip ci] update manifest.json url"
ref: ${{ github.ref }}
ref: ${{ github.event.workflow_run.head_branch || github.ref }}

- name: Write Deployment URL to Summary
run: |
Expand Down
Loading

0 comments on commit 9c3663f

Please sign in to comment.