Publish Packages workflow (kayba-ai/agentic-context-engine)
The Publish Packages workflow from kayba-ai/agentic-context-engine, explained and optimized by Latchkey.
CI health: C - fair
Point runs-on at Latchkey and get caching, job timeouts, SHA-pinned actions, self-healing for flaky steps, and up to 58% lower cost, applied automatically.
What it does
This is the Publish Packages workflow from the kayba-ai/agentic-context-engine repository, a real project running GitHub Actions. It is shown here with attribution under its Apache-2.0 license.
Below, Latchkey shows a faster, safer version produced by its optimization engine.
The workflow
name: Publish Packages
on:
release:
types: [published]
workflow_dispatch:
inputs:
test_pypi:
description: 'Publish to TestPyPI instead of PyPI'
required: false
default: 'false'
type: choice
options:
- 'true'
- 'false'
jobs:
# ── ace-framework (Python) ──────────────────────────────────────────
build-ace:
name: Build ace-framework
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.12'
- name: Install build dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: python -m build
- name: Store the distribution packages
uses: actions/upload-artifact@v4
with:
name: ace-framework-dist
path: dist/
# ── kayba-tracing (Python) ─────────────────────────────────────────
build-kayba-tracing:
name: Build kayba-tracing
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.12'
- name: Install build dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: python -m build sdk/python
- name: Store the distribution packages
uses: actions/upload-artifact@v4
with:
name: kayba-tracing-dist
path: sdk/python/dist/
# ── @kayba_ai/tracing (TypeScript) ────────────────────────────────────
build-kayba-tracing-ts:
name: Build @kayba_ai/tracing
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies
run: npm ci
working-directory: sdk/typescript
- name: Build
run: npm run build
working-directory: sdk/typescript
- name: Store the distribution packages
uses: actions/upload-artifact@v4
with:
name: kayba-tracing-ts-dist
path: |
sdk/typescript/dist/
sdk/typescript/package.json
# ── @kayba_ai/openclaw-tracing (TypeScript) ───────────────────────────
build-openclaw-tracing:
name: Build @kayba_ai/openclaw-tracing
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies
run: npm ci
working-directory: sdk/openclaw
- name: Build
run: npm run build
working-directory: sdk/openclaw
- name: Store the distribution packages
uses: actions/upload-artifact@v4
with:
name: openclaw-tracing-dist
path: |
sdk/openclaw/dist/
sdk/openclaw/package.json
sdk/openclaw/openclaw.plugin.json
sdk/openclaw/README.md
# ── Publish to TestPyPI ────────────────────────────────────────────
publish-to-testpypi:
name: Publish ace-framework to TestPyPI
if: github.event.inputs.test_pypi == 'true' || github.event_name == 'workflow_dispatch'
needs: [build-ace]
runs-on: ubuntu-latest
environment:
name: testpypi
url: https://test.pypi.org/project/ace-framework/
permissions:
id-token: write
steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: ace-framework-dist
path: dist/
- name: Publish to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
skip-existing: true
publish-kayba-tracing-to-testpypi:
name: Publish kayba-tracing to TestPyPI
if: github.event.inputs.test_pypi == 'true' || github.event_name == 'workflow_dispatch'
needs: [build-kayba-tracing]
runs-on: ubuntu-latest
environment:
name: testpypi
url: https://test.pypi.org/project/kayba-tracing/
permissions:
id-token: write
steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: kayba-tracing-dist
path: dist/
- name: Publish to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
skip-existing: true
# ── Publish to PyPI ────────────────────────────────────────────────
publish-to-pypi:
name: Publish ace-framework to PyPI
if: github.event_name == 'release'
needs: [build-ace]
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/project/ace-framework/
permissions:
id-token: write
steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: ace-framework-dist
path: dist/
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
publish-kayba-tracing-to-pypi:
name: Publish kayba-tracing to PyPI
if: github.event_name == 'release'
needs: [build-kayba-tracing]
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/project/kayba-tracing/
permissions:
id-token: write
steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: kayba-tracing-dist
path: dist/
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
# ── Publish to npm ─────────────────────────────────────────────────
publish-to-npm:
name: Publish @kayba_ai/tracing to npm
if: github.event_name == 'release'
needs: [build-kayba-tracing-ts]
runs-on: ubuntu-latest
environment:
name: npm
url: https://www.npmjs.com/package/@kayba_ai/tracing
permissions:
contents: read
steps:
- uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies
run: npm ci
working-directory: sdk/typescript
- name: Build
run: npm run build
working-directory: sdk/typescript
- name: Publish to npm
run: npm publish --access public
working-directory: sdk/typescript
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
publish-openclaw-tracing-to-npm:
name: Publish @kayba_ai/openclaw-tracing to npm
if: github.event_name == 'release'
needs: [build-openclaw-tracing]
runs-on: ubuntu-latest
environment:
name: npm
url: https://www.npmjs.com/package/@kayba_ai/openclaw-tracing
permissions:
contents: read
steps:
- uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies
run: npm ci
working-directory: sdk/openclaw
- name: Build
run: npm run build
working-directory: sdk/openclaw
- name: Publish to npm
run: npm publish --access public
working-directory: sdk/openclaw
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
The same workflow, on Latchkey
Estimated ~20% faster on cache hits, plus fewer wasted runs and a safer supply chain. Added and changed lines are highlighted.
name: Publish Packages on: release: types: [published] workflow_dispatch: inputs: test_pypi: description: 'Publish to TestPyPI instead of PyPI' required: false default: 'false' type: choice options: - 'true' - 'false' jobs: # ── ace-framework (Python) ────────────────────────────────────────── build-ace: timeout-minutes: 30 name: Build ace-framework runs-on: latchkey-small steps: - uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v4 with: python-version: '3.12' - name: Install build dependencies run: | python -m pip install --upgrade pip pip install build - name: Build package run: python -m build - name: Store the distribution packages uses: actions/upload-artifact@v4 with: name: ace-framework-dist path: dist/ # ── kayba-tracing (Python) ───────────────────────────────────────── build-kayba-tracing: timeout-minutes: 30 name: Build kayba-tracing runs-on: latchkey-small steps: - uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v4 with: python-version: '3.12' - name: Install build dependencies run: | python -m pip install --upgrade pip pip install build - name: Build package run: python -m build sdk/python - name: Store the distribution packages uses: actions/upload-artifact@v4 with: name: kayba-tracing-dist path: sdk/python/dist/ # ── @kayba_ai/tracing (TypeScript) ──────────────────────────────────── build-kayba-tracing-ts: timeout-minutes: 30 name: Build @kayba_ai/tracing runs-on: latchkey-small steps: - uses: actions/checkout@v4 - name: Set up Node.js uses: actions/setup-node@v4 with: cache: 'npm' node-version: '20' registry-url: 'https://registry.npmjs.org' - name: Install dependencies run: npm ci working-directory: sdk/typescript - name: Build run: npm run build working-directory: sdk/typescript - name: Store the distribution packages uses: actions/upload-artifact@v4 with: name: kayba-tracing-ts-dist path: | sdk/typescript/dist/ sdk/typescript/package.json # ── @kayba_ai/openclaw-tracing (TypeScript) ─────────────────────────── build-openclaw-tracing: timeout-minutes: 30 name: Build @kayba_ai/openclaw-tracing runs-on: latchkey-small steps: - uses: actions/checkout@v4 - name: Set up Node.js uses: actions/setup-node@v4 with: cache: 'npm' node-version: '22' registry-url: 'https://registry.npmjs.org' - name: Install dependencies run: npm ci working-directory: sdk/openclaw - name: Build run: npm run build working-directory: sdk/openclaw - name: Store the distribution packages uses: actions/upload-artifact@v4 with: name: openclaw-tracing-dist path: | sdk/openclaw/dist/ sdk/openclaw/package.json sdk/openclaw/openclaw.plugin.json sdk/openclaw/README.md # ── Publish to TestPyPI ──────────────────────────────────────────── publish-to-testpypi: timeout-minutes: 30 name: Publish ace-framework to TestPyPI if: github.event.inputs.test_pypi == 'true' || github.event_name == 'workflow_dispatch' needs: [build-ace] runs-on: latchkey-small environment: name: testpypi url: https://test.pypi.org/project/ace-framework/ permissions: id-token: write steps: - name: Download all the dists uses: actions/download-artifact@v4 with: name: ace-framework-dist path: dist/ - name: Publish to TestPyPI uses: pypa/gh-action-pypi-publish@release/v1 with: repository-url: https://test.pypi.org/legacy/ skip-existing: true publish-kayba-tracing-to-testpypi: timeout-minutes: 30 name: Publish kayba-tracing to TestPyPI if: github.event.inputs.test_pypi == 'true' || github.event_name == 'workflow_dispatch' needs: [build-kayba-tracing] runs-on: latchkey-small environment: name: testpypi url: https://test.pypi.org/project/kayba-tracing/ permissions: id-token: write steps: - name: Download all the dists uses: actions/download-artifact@v4 with: name: kayba-tracing-dist path: dist/ - name: Publish to TestPyPI uses: pypa/gh-action-pypi-publish@release/v1 with: repository-url: https://test.pypi.org/legacy/ skip-existing: true # ── Publish to PyPI ──────────────────────────────────────────────── publish-to-pypi: timeout-minutes: 30 name: Publish ace-framework to PyPI if: github.event_name == 'release' needs: [build-ace] runs-on: latchkey-small environment: name: pypi url: https://pypi.org/project/ace-framework/ permissions: id-token: write steps: - name: Download all the dists uses: actions/download-artifact@v4 with: name: ace-framework-dist path: dist/ - name: Publish to PyPI uses: pypa/gh-action-pypi-publish@release/v1 publish-kayba-tracing-to-pypi: timeout-minutes: 30 name: Publish kayba-tracing to PyPI if: github.event_name == 'release' needs: [build-kayba-tracing] runs-on: latchkey-small environment: name: pypi url: https://pypi.org/project/kayba-tracing/ permissions: id-token: write steps: - name: Download all the dists uses: actions/download-artifact@v4 with: name: kayba-tracing-dist path: dist/ - name: Publish to PyPI uses: pypa/gh-action-pypi-publish@release/v1 # ── Publish to npm ───────────────────────────────────────────────── publish-to-npm: timeout-minutes: 30 name: Publish @kayba_ai/tracing to npm if: github.event_name == 'release' needs: [build-kayba-tracing-ts] runs-on: latchkey-small environment: name: npm url: https://www.npmjs.com/package/@kayba_ai/tracing permissions: contents: read steps: - uses: actions/checkout@v4 - name: Set up Node.js uses: actions/setup-node@v4 with: cache: 'npm' node-version: '22' registry-url: 'https://registry.npmjs.org' - name: Install dependencies run: npm ci working-directory: sdk/typescript - name: Build run: npm run build working-directory: sdk/typescript - name: Publish to npm run: npm publish --access public working-directory: sdk/typescript env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} publish-openclaw-tracing-to-npm: timeout-minutes: 30 name: Publish @kayba_ai/openclaw-tracing to npm if: github.event_name == 'release' needs: [build-openclaw-tracing] runs-on: latchkey-small environment: name: npm url: https://www.npmjs.com/package/@kayba_ai/openclaw-tracing permissions: contents: read steps: - uses: actions/checkout@v4 - name: Set up Node.js uses: actions/setup-node@v4 with: cache: 'npm' node-version: '22' registry-url: 'https://registry.npmjs.org' - name: Install dependencies run: npm ci working-directory: sdk/openclaw - name: Build run: npm run build working-directory: sdk/openclaw - name: Publish to npm run: npm publish --access public working-directory: sdk/openclaw env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
What changed
- Run on Latchkey managed runners with one line (
runs-on), which apply the fixes below automatically and self-heal transient failures. This example useslatchkey-small; pick the runner size that fits the job. - Cache dependency installs on the setup step so they are served from cache.
- Add a job timeout so a hung step cannot burn hours of runner time.
1 third-party action is referenced by a movable tag. Pin it to the commit SHA (Latchkey resolves and applies this automatically) so a repointed tag cannot change what runs.
What Latchkey heals here
This workflow has steps that commonly fail on transient issues (network, registries, flaky browsers). On Latchkey managed runners they are detected, retried, and self-healed instead of failing your build:
- Dependency installs
This workflow runs 10 jobs per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.