Skip to content

fix(cloudflare): relocate wrangler.jsonc into apps/registry/ (#107) #103

fix(cloudflare): relocate wrangler.jsonc into apps/registry/ (#107)

fix(cloudflare): relocate wrangler.jsonc into apps/registry/ (#107) #103

Workflow file for this run

name: Release
on:
push:
branches: [main]
workflow_dispatch:
inputs:
publish_only:
description: 'Skip release-please and publish current packages/cli version to npm'
type: boolean
default: false
permissions:
contents: write
pull-requests: write
id-token: write
concurrency:
group: release
cancel-in-progress: false
jobs:
release-please:
name: Release Please
if: github.event_name == 'push' || inputs.publish_only != true
runs-on: ubuntu-latest
outputs:
cli_release_created: ${{ steps.release.outputs['packages/cli--release_created'] }}
cli_tag_name: ${{ steps.release.outputs['packages/cli--tag_name'] }}
schema_release_created: ${{ steps.release.outputs['packages/schema--release_created'] }}
schema_tag_name: ${{ steps.release.outputs['packages/schema--tag_name'] }}
steps:
- uses: googleapis/release-please-action@16a9c90856f42705d54a6fda1823352bdc62cf38 # v4.4.0
id: release
with:
config-file: release-please-config.json
manifest-file: .release-please-manifest.json
npm-publish:
name: Publish to npm
needs: release-please
if: |
always() &&
(
(github.event_name == 'workflow_dispatch' && inputs.publish_only == true) ||
(needs.release-please.result == 'success' &&
(needs.release-please.outputs.cli_release_created == 'true' ||
needs.release-please.outputs.schema_release_created == 'true'))
)
runs-on: ubuntu-latest
environment: npm
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
with:
bun-version: 1.3.11
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version-file: .nvmrc
registry-url: https://registry.npmjs.org
- uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5
with:
path: |
~/.bun/install/cache
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lock') }}
restore-keys: ${{ runner.os }}-bun-
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Build all
run: bun run build
# Workaround: bun pm pack resolves workspace:* from bun.lock, not
# package.json (oven-sh/bun#20477). release-please bumps versions in
# package.json but bun install won't propagate them to the lockfile
# (oven-sh/bun#18906). Patch only the workspace package versions in
# the lockfile — avoids a full re-resolve that could drift third-party
# dependencies.
- name: Sync lockfile with workspace versions
run: |
node -e "
const fs = require('fs');
const lock = fs.readFileSync('bun.lock', 'utf8');
const pkgs = ['packages/cli', 'packages/schema'];
let patched = lock;
for (const dir of pkgs) {
const { name, version } = JSON.parse(fs.readFileSync(dir + '/package.json', 'utf8'));
// Match: \"name\": \"<name>\",\n \"version\": \"<old>\",
const re = new RegExp('(\"name\":\\s*\"' + name.replace(/[/]/g, '\\\\/') + '\",\\n\\s*\"version\":\\s*\")([^\"]+)(\")');
patched = patched.replace(re, '$1' + version + '$3');
}
fs.writeFileSync('bun.lock', patched);
"
- name: Publish @pleaseai/ask-schema
if: |
github.event_name == 'workflow_dispatch' ||
needs.release-please.outputs.schema_release_created == 'true'
working-directory: packages/schema
run: |
VERSION=$(node -p "require('./package.json').version")
if npm view "@pleaseai/ask-schema@$VERSION" version 2>/dev/null; then
echo "⚠ @pleaseai/ask-schema@$VERSION already published, skipping"
else
bun pm pack
npm publish pleaseai-ask-schema-*.tgz --provenance --access public
fi
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Publish @pleaseai/ask
if: |
github.event_name == 'workflow_dispatch' ||
needs.release-please.outputs.cli_release_created == 'true'
working-directory: packages/cli
run: |
VERSION=$(node -p "require('./package.json').version")
if npm view "@pleaseai/ask@$VERSION" version 2>/dev/null; then
echo "⚠ @pleaseai/ask@$VERSION already published, skipping"
else
bun pm pack
npm publish pleaseai-ask-*.tgz --provenance --access public
fi
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}