Skip to content

feat: add sds CLI alias and update validation documentation #17

feat: add sds CLI alias and update validation documentation

feat: add sds CLI alias and update validation documentation #17

name: Publish Templates
on:
workflow_dispatch:
push:
branches:
- main
paths:
- 'packages/cli/templates/**'
- 'packages/cli/tests/**'
- '.github/workflows/publish-templates.yml'
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
permissions:
contents: write
jobs:
publish-templates:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v5
- name: Setup pnpm
uses: pnpm/action-setup@v5
with:
version: 10.29.2
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: 24
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build packages
run: pnpm build
- name: Validate template-related tests
run: pnpm --filter spec-driven-steroids test
- name: Build template bundle assets
run: |
node -e '
const fs = require("fs");
const path = require("path");
const repoRoot = process.cwd();
const templatesRoot = path.join(repoRoot, "packages/cli/templates");
const outputDir = path.join(repoRoot, ".template-release");
fs.rmSync(outputDir, { recursive: true, force: true });
fs.mkdirSync(outputDir, { recursive: true });
function walk(dir, prefix) {
prefix = prefix || "";
const entries = fs.readdirSync(dir, { withFileTypes: true });
const files = {};
for (const entry of entries) {
const absolutePath = path.join(dir, entry.name);
const relativePath = path.posix.join(prefix, entry.name);
if (entry.isDirectory()) {
Object.assign(files, walk(absolutePath, relativePath));
continue;
}
files[relativePath] = fs.readFileSync(absolutePath, "utf8");
}
return files;
}
const version = process.env.GITHUB_SHA || "local-" + Date.now();
const bundleFileName = "templates-bundle.json";
const manifest = {
version: version,
bundleUrl: "https://github.com/" + process.env.GITHUB_REPOSITORY + "/releases/download/templates-latest/" + bundleFileName,
publishedAt: new Date().toISOString()
};
const bundle = {
version: version,
files: walk(templatesRoot)
};
fs.writeFileSync(path.join(outputDir, "templates-manifest.json"), JSON.stringify(manifest, null, 2));
fs.writeFileSync(path.join(outputDir, bundleFileName), JSON.stringify(bundle, null, 2));
'
- name: Publish template release assets
uses: ncipollo/release-action@v1
with:
tag: templates-latest
name: templates-latest
allowUpdates: true
removeArtifacts: true
artifactErrorsFailBuild: true
replacesArtifacts: true
artifacts: .template-release/templates-manifest.json,.template-release/templates-bundle.json
body: Latest published template bundle for runtime injection.