diff --git a/.github/workflows/release-api-npm.yml b/.github/workflows/release-api-npm.yml new file mode 100644 index 00000000..0d243551 --- /dev/null +++ b/.github/workflows/release-api-npm.yml @@ -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 diff --git a/.github/workflows/release.yml b/.github/workflows/release-app.yml similarity index 99% rename from .github/workflows/release.yml rename to .github/workflows/release-app.yml index 90550ce5..d3a73d5c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release-app.yml @@ -1,4 +1,4 @@ -name: Generate Artifacts +name: Release App Artifacts on: push: tags: [v*] diff --git a/crates-cli/yaak-cli/src/cli.rs b/crates-cli/yaak-cli/src/cli.rs index 5bc43efe..b320e66a 100644 --- a/crates-cli/yaak-cli/src/cli.rs +++ b/crates-cli/yaak-cli/src/cli.rs @@ -4,6 +4,7 @@ use std::path::PathBuf; #[derive(Parser)] #[command(name = "yaak")] #[command(about = "Yaak CLI - API client from the command line")] +#[command(version)] pub struct Cli { /// Use a custom data directory #[arg(long, global = true)] diff --git a/npm/prepare-publish.js b/npm/prepare-publish.js index e5759e9e..ba15dbe2 100644 --- a/npm/prepare-publish.js +++ b/npm/prepare-publish.js @@ -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 version = process.env.YAAK_CLI_VERSION?.replace(/^v/, ""); @@ -50,6 +50,9 @@ for (const { src, dest } of binaries) { process.exit(1); } copyFileSync(src, dest); + if (!dest.endsWith(".exe")) { + chmodSync(dest, 0o755); + } } for (const pkg of packages) { diff --git a/package-lock.json b/package-lock.json index b34fb477..9da3b64f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -37,7 +37,6 @@ "plugins/template-function-cookie", "plugins/template-function-ctx", "plugins/template-function-encode", - "plugins/template-function-faker", "plugins/template-function-fs", "plugins/template-function-hash", "plugins/template-function-json", @@ -74,7 +73,7 @@ "devDependencies": { "@biomejs/biome": "^2.3.13", "@tauri-apps/cli": "^2.9.6", - "@yaakapp/cli": "^0.3.4", + "@yaakapp/cli": "^0.4.0-beta.1", "dotenv-cli": "^11.0.0", "husky": "^9.1.7", "nodejs-file-downloader": "^4.13.0", @@ -4327,27 +4326,28 @@ "link": true }, "node_modules/@yaakapp/cli": { - "version": "0.3.4", - "resolved": "https://registry.npmjs.org/@yaakapp/cli/-/cli-0.3.4.tgz", - "integrity": "sha512-bSSL3noEfyoPC0M+bj34jbBZbB+gwYLCHL9cf6BYHgkRQKlHFpvN6z8M2jQZljb+CTQdHK0NzosmwHLpjMmAVA==", + "version": "0.4.0-beta.1", + "resolved": "https://registry.npmjs.org/@yaakapp/cli/-/cli-0.4.0-beta.1.tgz", + "integrity": "sha512-Q/nRjS9nSNZy8PSBJ8VfczwSmfK4k/s9Co5YnsCiomyFppDiIR4hGjwwXAZDjcjnVZYrzAboRM2BXMjJ9PfZCA==", "dev": true, "hasInstallScript": true, "bin": { + "yaak": "bin/cli.js", "yaakcli": "bin/cli.js" }, "optionalDependencies": { - "@yaakapp/cli-darwin-arm64": "0.3.4", - "@yaakapp/cli-darwin-x64": "0.3.4", - "@yaakapp/cli-linux-arm64": "0.3.4", - "@yaakapp/cli-linux-x64": "0.3.4", - "@yaakapp/cli-win32-arm64": "0.3.4", - "@yaakapp/cli-win32-x64": "0.3.4" + "@yaakapp/cli-darwin-arm64": "0.4.0-beta.1", + "@yaakapp/cli-darwin-x64": "0.4.0-beta.1", + "@yaakapp/cli-linux-arm64": "0.4.0-beta.1", + "@yaakapp/cli-linux-x64": "0.4.0-beta.1", + "@yaakapp/cli-win32-arm64": "0.4.0-beta.1", + "@yaakapp/cli-win32-x64": "0.4.0-beta.1" } }, "node_modules/@yaakapp/cli-darwin-arm64": { - "version": "0.3.4", - "resolved": "https://registry.npmjs.org/@yaakapp/cli-darwin-arm64/-/cli-darwin-arm64-0.3.4.tgz", - "integrity": "sha512-iTohEO7XSVZwSvTgEQE9my3wGyWtTl1q8yfol7hHwVFTX7G8Geh8X2j2vVokHhj7J9OZL9jtYQWIsM1ekOHSEQ==", + "version": "0.4.0-beta.1", + "resolved": "https://registry.npmjs.org/@yaakapp/cli-darwin-arm64/-/cli-darwin-arm64-0.4.0-beta.1.tgz", + "integrity": "sha512-afvIQeT35bI6d6fRyJ6hnfr0FnzajL4wiVPniezXXEFsVjG74/FPB7jYHRTnIVwG+tPziOND1RG1ff3Hle/Duw==", "cpu": [ "arm64" ], @@ -4358,9 +4358,9 @@ ] }, "node_modules/@yaakapp/cli-darwin-x64": { - "version": "0.3.4", - "resolved": "https://registry.npmjs.org/@yaakapp/cli-darwin-x64/-/cli-darwin-x64-0.3.4.tgz", - "integrity": "sha512-gz7IcjFGKA0cCAum1Aq8kmVg7erYYSrZ9pliDw0NZyObjrBysJcsDXLodEU437u0pihtdCfoLsq3rsYYs8uwCA==", + "version": "0.4.0-beta.1", + "resolved": "https://registry.npmjs.org/@yaakapp/cli-darwin-x64/-/cli-darwin-x64-0.4.0-beta.1.tgz", + "integrity": "sha512-4j2AwBnbmVgbzkqLDEZtSQ+/PvJ/eo6GecJcBW92YWnwR4+/R5vPT87Pd0Dy2L4X7Hy2VVmNbwNAEOVvef+u6g==", "cpu": [ "x64" ], @@ -4371,9 +4371,9 @@ ] }, "node_modules/@yaakapp/cli-linux-arm64": { - "version": "0.3.4", - "resolved": "https://registry.npmjs.org/@yaakapp/cli-linux-arm64/-/cli-linux-arm64-0.3.4.tgz", - "integrity": "sha512-Yiwz8PBkXngmr0lTMW1pgy+F/kUISkzvqofdoBseXTrS/GDxoW3ILnG3If30LuIyWWPgqpuU+qKMtbVDzuncPQ==", + "version": "0.4.0-beta.1", + "resolved": "https://registry.npmjs.org/@yaakapp/cli-linux-arm64/-/cli-linux-arm64-0.4.0-beta.1.tgz", + "integrity": "sha512-WgqeTcj7BIgCF1chunX/XcxmpArftYATO1q61aNPxNxIVDKVqbbOh/rLByvwFM8q9A49OjgcLI4QQT1CWdBLig==", "cpu": [ "arm64" ], @@ -4384,9 +4384,9 @@ ] }, "node_modules/@yaakapp/cli-linux-x64": { - "version": "0.3.4", - "resolved": "https://registry.npmjs.org/@yaakapp/cli-linux-x64/-/cli-linux-x64-0.3.4.tgz", - "integrity": "sha512-j7/r18UYNlFChDVU5N5ye3mmL+OR9Uu3LY72JxW+s/SyV69Bo8Griii75Wt19z/jj2ES8pxD+4IJq56VF3wJ7w==", + "version": "0.4.0-beta.1", + "resolved": "https://registry.npmjs.org/@yaakapp/cli-linux-x64/-/cli-linux-x64-0.4.0-beta.1.tgz", + "integrity": "sha512-eMN7CiTbB4pH5NIHTGqNiv56PXb+V7cGg/yU+FopRk69ETH1n+cwGlx1UxSUlcLnaxx0s6pPoo3e+C4cq+i0BQ==", "cpu": [ "x64" ], @@ -4397,9 +4397,9 @@ ] }, "node_modules/@yaakapp/cli-win32-arm64": { - "version": "0.3.4", - "resolved": "https://registry.npmjs.org/@yaakapp/cli-win32-arm64/-/cli-win32-arm64-0.3.4.tgz", - "integrity": "sha512-OUSKOKrSnzrTAGW0c+2ZCwA4yhgw/bA+gyeTvpf7cELVuB0qooGkEcJ3lM7fPMKmUbFU0r+K/Ggq1QMUr7cJLQ==", + "version": "0.4.0-beta.1", + "resolved": "https://registry.npmjs.org/@yaakapp/cli-win32-arm64/-/cli-win32-arm64-0.4.0-beta.1.tgz", + "integrity": "sha512-4ygqyEeHLNlTAWYpg83SuLK9dx1af6HqSfHnWFBigflENdZejD/oSGNr1XZeB61QQnjlvaJaqENs4BS9UI9piA==", "cpu": [ "arm64" ], @@ -4410,9 +4410,9 @@ ] }, "node_modules/@yaakapp/cli-win32-x64": { - "version": "0.3.4", - "resolved": "https://registry.npmjs.org/@yaakapp/cli-win32-x64/-/cli-win32-x64-0.3.4.tgz", - "integrity": "sha512-sVYnW1rROLbzFUCyeZ++ibN+8gJS7FdPnBRHIE0KORfeI4e7Gw/aMUji2qpSZ1gt3DrAU95DDNjBkDvGBAgqag==", + "version": "0.4.0-beta.1", + "resolved": "https://registry.npmjs.org/@yaakapp/cli-win32-x64/-/cli-win32-x64-0.4.0-beta.1.tgz", + "integrity": "sha512-Xpxk+e9RWKOzY9siMDlgZPa0HU61GsTn5CTHOpPxUJHmUu+7urJ+sEgaoZx4fRjPBH+FVD9Y4s+zRCawd7O75w==", "cpu": [ "x64" ], diff --git a/package.json b/package.json index 2f03a786..117f5049 100644 --- a/package.json +++ b/package.json @@ -98,7 +98,7 @@ "devDependencies": { "@biomejs/biome": "^2.3.13", "@tauri-apps/cli": "^2.9.6", - "@yaakapp/cli": "^0.3.4", + "@yaakapp/cli": "^0.4.0-beta.1", "dotenv-cli": "^11.0.0", "husky": "^9.1.7", "nodejs-file-downloader": "^4.13.0",