Add API release workflow and harden CLI npm publish

This commit is contained in:
Gregory Schier
2026-02-22 14:11:26 -08:00
parent a19ee9b502
commit 8315e4afad
6 changed files with 95 additions and 32 deletions

59
.github/workflows/release-api-npm.yml vendored Normal file
View File

@@ -0,0 +1,59 @@
name: Release API to NPM
on:
push:
tags: [yaak-api-*]
workflow_dispatch:
inputs:
version:
description: API version to publish (for example 0.9.0 or v0.9.0)
required: true
type: string
permissions:
contents: read
jobs:
publish-npm:
name: Publish @yaakapp/api
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: lts/*
registry-url: https://registry.npmjs.org
- name: Install dependencies
run: npm ci
- name: Set @yaakapp/api version
shell: bash
env:
WORKFLOW_VERSION: ${{ inputs.version }}
run: |
set -euo pipefail
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
VERSION="$WORKFLOW_VERSION"
else
VERSION="${GITHUB_REF_NAME#yaak-api-}"
fi
VERSION="${VERSION#v}"
echo "Preparing @yaakapp/api version: $VERSION"
cd packages/plugin-runtime-types
npm version "$VERSION" --no-git-tag-version --allow-same-version
- name: Build @yaakapp/api
working-directory: packages/plugin-runtime-types
run: npm run build
- name: Publish @yaakapp/api
working-directory: packages/plugin-runtime-types
run: npm publish --provenance --access public

View File

@@ -1,4 +1,4 @@
name: Generate Artifacts name: Release App Artifacts
on: on:
push: push:
tags: [v*] tags: [v*]

View File

@@ -4,6 +4,7 @@ use std::path::PathBuf;
#[derive(Parser)] #[derive(Parser)]
#[command(name = "yaak")] #[command(name = "yaak")]
#[command(about = "Yaak CLI - API client from the command line")] #[command(about = "Yaak CLI - API client from the command line")]
#[command(version)]
pub struct Cli { pub struct Cli {
/// Use a custom data directory /// Use a custom data directory
#[arg(long, global = true)] #[arg(long, global = true)]

View File

@@ -1,4 +1,4 @@
const { copyFileSync, existsSync, readFileSync, writeFileSync } = require("node:fs"); const { chmodSync, copyFileSync, existsSync, readFileSync, writeFileSync } = require("node:fs");
const { join } = require("node:path"); const { join } = require("node:path");
const version = process.env.YAAK_CLI_VERSION?.replace(/^v/, ""); const version = process.env.YAAK_CLI_VERSION?.replace(/^v/, "");
@@ -50,6 +50,9 @@ for (const { src, dest } of binaries) {
process.exit(1); process.exit(1);
} }
copyFileSync(src, dest); copyFileSync(src, dest);
if (!dest.endsWith(".exe")) {
chmodSync(dest, 0o755);
}
} }
for (const pkg of packages) { for (const pkg of packages) {

58
package-lock.json generated
View File

@@ -37,7 +37,6 @@
"plugins/template-function-cookie", "plugins/template-function-cookie",
"plugins/template-function-ctx", "plugins/template-function-ctx",
"plugins/template-function-encode", "plugins/template-function-encode",
"plugins/template-function-faker",
"plugins/template-function-fs", "plugins/template-function-fs",
"plugins/template-function-hash", "plugins/template-function-hash",
"plugins/template-function-json", "plugins/template-function-json",
@@ -74,7 +73,7 @@
"devDependencies": { "devDependencies": {
"@biomejs/biome": "^2.3.13", "@biomejs/biome": "^2.3.13",
"@tauri-apps/cli": "^2.9.6", "@tauri-apps/cli": "^2.9.6",
"@yaakapp/cli": "^0.3.4", "@yaakapp/cli": "^0.4.0-beta.1",
"dotenv-cli": "^11.0.0", "dotenv-cli": "^11.0.0",
"husky": "^9.1.7", "husky": "^9.1.7",
"nodejs-file-downloader": "^4.13.0", "nodejs-file-downloader": "^4.13.0",
@@ -4327,27 +4326,28 @@
"link": true "link": true
}, },
"node_modules/@yaakapp/cli": { "node_modules/@yaakapp/cli": {
"version": "0.3.4", "version": "0.4.0-beta.1",
"resolved": "https://registry.npmjs.org/@yaakapp/cli/-/cli-0.3.4.tgz", "resolved": "https://registry.npmjs.org/@yaakapp/cli/-/cli-0.4.0-beta.1.tgz",
"integrity": "sha512-bSSL3noEfyoPC0M+bj34jbBZbB+gwYLCHL9cf6BYHgkRQKlHFpvN6z8M2jQZljb+CTQdHK0NzosmwHLpjMmAVA==", "integrity": "sha512-Q/nRjS9nSNZy8PSBJ8VfczwSmfK4k/s9Co5YnsCiomyFppDiIR4hGjwwXAZDjcjnVZYrzAboRM2BXMjJ9PfZCA==",
"dev": true, "dev": true,
"hasInstallScript": true, "hasInstallScript": true,
"bin": { "bin": {
"yaak": "bin/cli.js",
"yaakcli": "bin/cli.js" "yaakcli": "bin/cli.js"
}, },
"optionalDependencies": { "optionalDependencies": {
"@yaakapp/cli-darwin-arm64": "0.3.4", "@yaakapp/cli-darwin-arm64": "0.4.0-beta.1",
"@yaakapp/cli-darwin-x64": "0.3.4", "@yaakapp/cli-darwin-x64": "0.4.0-beta.1",
"@yaakapp/cli-linux-arm64": "0.3.4", "@yaakapp/cli-linux-arm64": "0.4.0-beta.1",
"@yaakapp/cli-linux-x64": "0.3.4", "@yaakapp/cli-linux-x64": "0.4.0-beta.1",
"@yaakapp/cli-win32-arm64": "0.3.4", "@yaakapp/cli-win32-arm64": "0.4.0-beta.1",
"@yaakapp/cli-win32-x64": "0.3.4" "@yaakapp/cli-win32-x64": "0.4.0-beta.1"
} }
}, },
"node_modules/@yaakapp/cli-darwin-arm64": { "node_modules/@yaakapp/cli-darwin-arm64": {
"version": "0.3.4", "version": "0.4.0-beta.1",
"resolved": "https://registry.npmjs.org/@yaakapp/cli-darwin-arm64/-/cli-darwin-arm64-0.3.4.tgz", "resolved": "https://registry.npmjs.org/@yaakapp/cli-darwin-arm64/-/cli-darwin-arm64-0.4.0-beta.1.tgz",
"integrity": "sha512-iTohEO7XSVZwSvTgEQE9my3wGyWtTl1q8yfol7hHwVFTX7G8Geh8X2j2vVokHhj7J9OZL9jtYQWIsM1ekOHSEQ==", "integrity": "sha512-afvIQeT35bI6d6fRyJ6hnfr0FnzajL4wiVPniezXXEFsVjG74/FPB7jYHRTnIVwG+tPziOND1RG1ff3Hle/Duw==",
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
@@ -4358,9 +4358,9 @@
] ]
}, },
"node_modules/@yaakapp/cli-darwin-x64": { "node_modules/@yaakapp/cli-darwin-x64": {
"version": "0.3.4", "version": "0.4.0-beta.1",
"resolved": "https://registry.npmjs.org/@yaakapp/cli-darwin-x64/-/cli-darwin-x64-0.3.4.tgz", "resolved": "https://registry.npmjs.org/@yaakapp/cli-darwin-x64/-/cli-darwin-x64-0.4.0-beta.1.tgz",
"integrity": "sha512-gz7IcjFGKA0cCAum1Aq8kmVg7erYYSrZ9pliDw0NZyObjrBysJcsDXLodEU437u0pihtdCfoLsq3rsYYs8uwCA==", "integrity": "sha512-4j2AwBnbmVgbzkqLDEZtSQ+/PvJ/eo6GecJcBW92YWnwR4+/R5vPT87Pd0Dy2L4X7Hy2VVmNbwNAEOVvef+u6g==",
"cpu": [ "cpu": [
"x64" "x64"
], ],
@@ -4371,9 +4371,9 @@
] ]
}, },
"node_modules/@yaakapp/cli-linux-arm64": { "node_modules/@yaakapp/cli-linux-arm64": {
"version": "0.3.4", "version": "0.4.0-beta.1",
"resolved": "https://registry.npmjs.org/@yaakapp/cli-linux-arm64/-/cli-linux-arm64-0.3.4.tgz", "resolved": "https://registry.npmjs.org/@yaakapp/cli-linux-arm64/-/cli-linux-arm64-0.4.0-beta.1.tgz",
"integrity": "sha512-Yiwz8PBkXngmr0lTMW1pgy+F/kUISkzvqofdoBseXTrS/GDxoW3ILnG3If30LuIyWWPgqpuU+qKMtbVDzuncPQ==", "integrity": "sha512-WgqeTcj7BIgCF1chunX/XcxmpArftYATO1q61aNPxNxIVDKVqbbOh/rLByvwFM8q9A49OjgcLI4QQT1CWdBLig==",
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
@@ -4384,9 +4384,9 @@
] ]
}, },
"node_modules/@yaakapp/cli-linux-x64": { "node_modules/@yaakapp/cli-linux-x64": {
"version": "0.3.4", "version": "0.4.0-beta.1",
"resolved": "https://registry.npmjs.org/@yaakapp/cli-linux-x64/-/cli-linux-x64-0.3.4.tgz", "resolved": "https://registry.npmjs.org/@yaakapp/cli-linux-x64/-/cli-linux-x64-0.4.0-beta.1.tgz",
"integrity": "sha512-j7/r18UYNlFChDVU5N5ye3mmL+OR9Uu3LY72JxW+s/SyV69Bo8Griii75Wt19z/jj2ES8pxD+4IJq56VF3wJ7w==", "integrity": "sha512-eMN7CiTbB4pH5NIHTGqNiv56PXb+V7cGg/yU+FopRk69ETH1n+cwGlx1UxSUlcLnaxx0s6pPoo3e+C4cq+i0BQ==",
"cpu": [ "cpu": [
"x64" "x64"
], ],
@@ -4397,9 +4397,9 @@
] ]
}, },
"node_modules/@yaakapp/cli-win32-arm64": { "node_modules/@yaakapp/cli-win32-arm64": {
"version": "0.3.4", "version": "0.4.0-beta.1",
"resolved": "https://registry.npmjs.org/@yaakapp/cli-win32-arm64/-/cli-win32-arm64-0.3.4.tgz", "resolved": "https://registry.npmjs.org/@yaakapp/cli-win32-arm64/-/cli-win32-arm64-0.4.0-beta.1.tgz",
"integrity": "sha512-OUSKOKrSnzrTAGW0c+2ZCwA4yhgw/bA+gyeTvpf7cELVuB0qooGkEcJ3lM7fPMKmUbFU0r+K/Ggq1QMUr7cJLQ==", "integrity": "sha512-4ygqyEeHLNlTAWYpg83SuLK9dx1af6HqSfHnWFBigflENdZejD/oSGNr1XZeB61QQnjlvaJaqENs4BS9UI9piA==",
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
@@ -4410,9 +4410,9 @@
] ]
}, },
"node_modules/@yaakapp/cli-win32-x64": { "node_modules/@yaakapp/cli-win32-x64": {
"version": "0.3.4", "version": "0.4.0-beta.1",
"resolved": "https://registry.npmjs.org/@yaakapp/cli-win32-x64/-/cli-win32-x64-0.3.4.tgz", "resolved": "https://registry.npmjs.org/@yaakapp/cli-win32-x64/-/cli-win32-x64-0.4.0-beta.1.tgz",
"integrity": "sha512-sVYnW1rROLbzFUCyeZ++ibN+8gJS7FdPnBRHIE0KORfeI4e7Gw/aMUji2qpSZ1gt3DrAU95DDNjBkDvGBAgqag==", "integrity": "sha512-Xpxk+e9RWKOzY9siMDlgZPa0HU61GsTn5CTHOpPxUJHmUu+7urJ+sEgaoZx4fRjPBH+FVD9Y4s+zRCawd7O75w==",
"cpu": [ "cpu": [
"x64" "x64"
], ],

View File

@@ -98,7 +98,7 @@
"devDependencies": { "devDependencies": {
"@biomejs/biome": "^2.3.13", "@biomejs/biome": "^2.3.13",
"@tauri-apps/cli": "^2.9.6", "@tauri-apps/cli": "^2.9.6",
"@yaakapp/cli": "^0.3.4", "@yaakapp/cli": "^0.4.0-beta.1",
"dotenv-cli": "^11.0.0", "dotenv-cli": "^11.0.0",
"husky": "^9.1.7", "husky": "^9.1.7",
"nodejs-file-downloader": "^4.13.0", "nodejs-file-downloader": "^4.13.0",