Skip to content

Release

Release #20

Workflow file for this run

name: Release
# Manual-only release for v0.x. Pick patch / minor / major from the Actions UI.
# Auto-triggers (cron + repository_dispatch) are commented out until the
# pipeline is proven across a few manual releases.
on:
workflow_dispatch:
inputs:
version_bump:
description: 'patch | minor | major'
required: false
default: 'patch'
# repository_dispatch:
# types: [openapi-updated]
# schedule:
# - cron: '0 6 * * *'
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
steps:
- uses: actions/checkout@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-node@v6
with:
node-version: '24'
registry-url: 'https://registry.npmjs.org'
- uses: oven-sh/setup-bun@v2
- run: bun install --frozen-lockfile
- name: Regenerate types from spec
run: bun run generate
- name: Spec drift gate
run: |
if ! git diff --exit-code -- specs/openapi.json packages/ui/src/types/; then
echo "OpenAPI spec or generated types are stale relative to live API. Local must be in sync before release."
exit 1
fi
- name: Sync docs from spec
run: bun run docs:sync
- name: Check if spec changed
id: diff
run: |
OLD=$(git show HEAD:specs/openapi.json 2>/dev/null | jq -cS '{paths, components}' || echo '')
NEW=$(jq -cS '{paths, components}' specs/openapi.json)
if [ "$OLD" = "$NEW" ]; then
echo "changed=false" >> $GITHUB_OUTPUT
else
echo "changed=true" >> $GITHUB_OUTPUT
fi
- name: Lint
if: steps.diff.outputs.changed == 'true' || github.event_name == 'workflow_dispatch'
run: bun run check
- name: Typecheck
if: steps.diff.outputs.changed == 'true' || github.event_name == 'workflow_dispatch'
run: bun run typecheck
- name: Build
if: steps.diff.outputs.changed == 'true' || github.event_name == 'workflow_dispatch'
run: bun run build
- name: Unit tests
if: steps.diff.outputs.changed == 'true' || github.event_name == 'workflow_dispatch'
run: bun run test
- name: Install Playwright browsers
if: steps.diff.outputs.changed == 'true' || github.event_name == 'workflow_dispatch'
run: bunx playwright install --with-deps chromium firefox webkit
- name: E2E tests
if: steps.diff.outputs.changed == 'true' || github.event_name == 'workflow_dispatch'
run: bun run test:e2e
- name: UI audit (no [object Object], no empty-state drift)
if: steps.diff.outputs.changed == 'true' || github.event_name == 'workflow_dispatch'
run: |
bun run preview &
PREVIEW_PID=$!
for i in $(seq 1 30); do
curl -sf http://localhost:3001 > /dev/null && break
sleep 1
done
bun run audit
AUDIT_EXIT=$?
kill $PREVIEW_PID 2>/dev/null || true
exit $AUDIT_EXIT
- name: Bump versions and rebuild
id: bump
if: steps.diff.outputs.changed == 'true' || github.event_name == 'workflow_dispatch'
run: |
BUMP="${{ github.event.inputs.version_bump || 'patch' }}"
bump() {
local file="$1/package.json"
local current new
current=$(jq -r '.version' "$file")
IFS='.' read -r MA MI PA <<< "$current"
case "$BUMP" in
major) MA=$((MA+1)); MI=0; PA=0 ;;
minor) MI=$((MI+1)); PA=0 ;;
*) PA=$((PA+1)) ;;
esac
new="$MA.$MI.$PA"
jq --arg v "$new" '.version = $v' "$file" > "$file.tmp" && mv "$file.tmp" "$file"
echo "$1 -> $new"
}
bump packages/ui
bump packages/ui-react
VERSION=$(jq -r '.version' packages/ui/package.json)
echo "version=$VERSION" >> $GITHUB_OUTPUT
bun run build
- name: Publish @roxyapi/ui
if: steps.diff.outputs.changed == 'true' || github.event_name == 'workflow_dispatch'
run: |
npm install -g npm@latest
(cd packages/ui && npm publish --access public --provenance)
- name: Publish @roxyapi/ui-react
if: steps.diff.outputs.changed == 'true' || github.event_name == 'workflow_dispatch'
run: |
(cd packages/ui-react && npm publish --access public --provenance)
- name: Commit, tag, push
if: steps.diff.outputs.changed == 'true' || github.event_name == 'workflow_dispatch'
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
VERSION=$(node -p "require('./packages/ui/package.json').version")
# dist/ is gitignored: npm publish (above) already shipped it via the
# package.json `files` allowlist. Commit only source, version bumps,
# and the committed codegen (registry, manifest, docs tables).
git add packages/ registry/ apps/docs/manifest.js README.md AGENTS.md
git commit -m "release: v$VERSION"
git tag "v$VERSION"
git push --follow-tags
- name: Pack npm tarballs for release assets
if: steps.diff.outputs.changed == 'true' || github.event_name == 'workflow_dispatch'
run: |
mkdir -p .release-assets
(cd packages/ui && npm pack --pack-destination ../../.release-assets)
(cd packages/ui-react && npm pack --pack-destination ../../.release-assets)
ls -la .release-assets/
- name: Create GitHub release
if: steps.diff.outputs.changed == 'true' || github.event_name == 'workflow_dispatch'
uses: softprops/action-gh-release@v3
with:
tag_name: v${{ steps.bump.outputs.version }}
generate_release_notes: true
make_latest: 'true'
files: |
.release-assets/*.tgz