Skip to content
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
123 changes: 123 additions & 0 deletions .github/workflows/publish-engine.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
name: Publish Engine

# Independent publish flow for @relaycast/engine.
#
# The engine is versioned and released SEPARATELY from the lockstep
# @relaycast/* packages (see publish-npm.yml). This lets the open-core engine
# ship on its own cadence (e.g. 1.3.0-rc.x on the `next` tag) without bumping
# the SDK/types/server set. Triggered manually.

on:
workflow_dispatch:
inputs:
version:
description: "Version bump type (ignored if custom_version is set)"
required: true
type: choice
options:
- prerelease
- prepatch
- preminor
- premajor
- patch
- minor
- major
default: "prerelease"
custom_version:
description: "Custom version, e.g. 1.3.0-rc.0 (overrides bump type)"
required: false
type: string
tag:
description: "NPM dist-tag"
required: true
type: choice
options:
- next
- latest
- beta
- alpha
default: "next"
dry_run:
description: "Dry run (do not actually publish)"
required: false
type: boolean
default: true

concurrency:
group: publish-engine
cancel-in-progress: false

permissions:
contents: read
id-token: write

env:
NPM_CONFIG_FUND: false

jobs:
publish:
name: Build, test & publish @relaycast/engine
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "22.14.0"
cache: "npm"
cache-dependency-path: package-lock.json
registry-url: "https://registry.npmjs.org"

- name: Install dependencies
run: npm ci

- name: Set engine version
id: ver
working-directory: packages/engine
env:
# Bound to env (not interpolated into the script body) to avoid shell
# injection from the free-form custom_version input.
CUSTOM_VERSION: ${{ github.event.inputs.custom_version }}
VERSION_TYPE: ${{ github.event.inputs.version }}
run: |
if [ -n "$CUSTOM_VERSION" ]; then
npm version "$CUSTOM_VERSION" --no-git-tag-version --allow-same-version
else
npm version "$VERSION_TYPE" --no-git-tag-version --preid=rc
fi
NEW_VERSION=$(node -p "require('./package.json').version")
echo "version=$NEW_VERSION" >> "$GITHUB_OUTPUT"
echo "Publishing @relaycast/engine@$NEW_VERSION"
Comment thread
willwashburn marked this conversation as resolved.

- name: Build engine (and its workspace deps)
run: npx turbo build --filter=@relaycast/engine

- name: Test engine
run: npx turbo test --filter=@relaycast/engine
env:
DO_NOT_TRACK: '1'

- name: Update npm for OIDC/provenance support
run: npm install -g npm@latest

- name: Dry run
if: github.event.inputs.dry_run == 'true'
working-directory: packages/engine
run: npm publish --dry-run --access public --tag "${{ github.event.inputs.tag }}" --ignore-scripts

- name: Publish to NPM
if: github.event.inputs.dry_run != 'true'
working-directory: packages/engine
run: npm publish --access public --provenance --tag "${{ github.event.inputs.tag }}" --ignore-scripts

- name: Summary
if: always()
run: |
echo "## Publish Engine" >> "$GITHUB_STEP_SUMMARY"
echo "" >> "$GITHUB_STEP_SUMMARY"
echo "**Package**: \`@relaycast/engine\`" >> "$GITHUB_STEP_SUMMARY"
echo "**Version**: \`${{ steps.ver.outputs.version }}\`" >> "$GITHUB_STEP_SUMMARY"
echo "**NPM Tag**: \`${{ github.event.inputs.tag }}\`" >> "$GITHUB_STEP_SUMMARY"
echo "**Dry Run**: \`${{ github.event.inputs.dry_run }}\`" >> "$GITHUB_STEP_SUMMARY"
8 changes: 7 additions & 1 deletion .github/workflows/publish-npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,16 +119,22 @@ jobs:
const version = '$NEW_VERSION';

const packagesDir = 'packages';
// @relaycast/engine is versioned + published independently
// (see publish-engine.yml); never touch it in the lockstep sweep,
// and don't rewrite other packages' dependency on it.
const SKIP = new Set(['engine']);
for (const dir of fs.readdirSync(packagesDir)) {
if (SKIP.has(dir)) { console.log('skip (independent): ' + dir); continue; }
const pkgPath = path.join(packagesDir, dir, 'package.json');
if (fs.existsSync(pkgPath)) {
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
pkg.version = version;

// Update @relaycast/* dependencies to exact version
// (except @relaycast/engine, which is independently versioned).
for (const depType of ['dependencies', 'devDependencies', 'peerDependencies']) {
for (const dep of Object.keys(pkg[depType] || {})) {
if (dep.startsWith('@relaycast/')) {
if (dep.startsWith('@relaycast/') && dep !== '@relaycast/engine') {
pkg[depType][dep] = version;
}
}
Expand Down
Loading
Loading