Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge development into main #31

Merged
merged 16 commits into from
Dec 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/update-configuration.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
name: "Update Configuration"
name: "Update Configuration and Build"

on:
workflow_dispatch:
push:

jobs:
update:
name: "Update Configuration in manifest.json"
name: "Update Configuration & Build"
runs-on: ubuntu-latest
permissions: write-all

Expand Down
57 changes: 52 additions & 5 deletions .github/workflows/worker-deploy.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,38 @@
name: Deploy Worker

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

env:
APP_ID: ${{ secrets.APP_ID }}
APP_PRIVATE_KEY: ${{ secrets.APP_PRIVATE_KEY }}

jobs:
deploy-to-cloudflare:
runs-on: ubuntu-latest
name: Automatic Cloudflare Deploy
environment: ${{ github.ref == 'refs/heads/main' && 'main' || 'development' }}
permissions:
contents: write

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

- name: Enable corepack
run: corepack enable

- uses: actions/checkout@v4

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

- name: Update wrangler.toml Name Field
run: |
branch_name=$(echo '${{ github.event.ref }}' | sed 's#refs/heads/##' | sed 's#[^a-zA-Z0-9]#-#g')
branch_name=$(echo '${{ 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 Down Expand Up @@ -56,6 +63,46 @@ jobs:
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}

- name: Update manifest.json worker url
uses: actions/github-script@v7
with:
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);

- name: Get GitHub App token
if: env.APP_ID != '' && env.APP_PRIVATE_KEY != ''
uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ env.APP_ID }}
private-key: ${{ env.APP_PRIVATE_KEY }}

- name: Format manifest.json using Prettier
shell: bash
run: |
bun add -DE prettier
bun prettier --write .

- name: Commit file
uses: swinton/[email protected]
env:
GH_TOKEN: ${{ steps.app-token.outputs.token || secrets.GITHUB_TOKEN }}
with:
files: |
manifest.json
commit-message: "chore: [skip ci] update manifest.json url"
ref: ${{ github.ref }}

- name: Write Deployment URL to Summary
run: |
echo "### Deployment URL" >> $GITHUB_STEP_SUMMARY
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@
"properties": {
"allowPublicQuery": {
"default": true,
"description": "Allows any user to query anyone else. If false, only org members can query others.",
"type": "boolean"
}
}
}
},
"homepage_url": "https://ubiquity-os-command-query-user-development.ubiquity.workers.dev"
}
2 changes: 1 addition & 1 deletion src/types/plugin-input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export const pluginSettingsSchema = T.Object({
/**
* Allows any user to query anyone else. If false, only org members can query others.
*/
allowPublicQuery: T.Optional(T.Boolean({ default: true })),
allowPublicQuery: T.Optional(T.Boolean({ default: true, description: "Allows any user to query anyone else. If false, only org members can query others." })),
});

export type PluginSettings = StaticDecode<typeof pluginSettingsSchema>;
Loading