Skip to content

Commit 8315e4a

Browse files
committed
Add API release workflow and harden CLI npm publish
1 parent a19ee9b commit 8315e4a

6 files changed

Lines changed: 95 additions & 32 deletions

File tree

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Release API to NPM
2+
3+
on:
4+
push:
5+
tags: [yaak-api-*]
6+
workflow_dispatch:
7+
inputs:
8+
version:
9+
description: API version to publish (for example 0.9.0 or v0.9.0)
10+
required: true
11+
type: string
12+
13+
permissions:
14+
contents: read
15+
16+
jobs:
17+
publish-npm:
18+
name: Publish @yaakapp/api
19+
runs-on: ubuntu-latest
20+
permissions:
21+
contents: read
22+
id-token: write
23+
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v4
27+
28+
- name: Setup Node
29+
uses: actions/setup-node@v4
30+
with:
31+
node-version: lts/*
32+
registry-url: https://registry.npmjs.org
33+
34+
- name: Install dependencies
35+
run: npm ci
36+
37+
- name: Set @yaakapp/api version
38+
shell: bash
39+
env:
40+
WORKFLOW_VERSION: ${{ inputs.version }}
41+
run: |
42+
set -euo pipefail
43+
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
44+
VERSION="$WORKFLOW_VERSION"
45+
else
46+
VERSION="${GITHUB_REF_NAME#yaak-api-}"
47+
fi
48+
VERSION="${VERSION#v}"
49+
echo "Preparing @yaakapp/api version: $VERSION"
50+
cd packages/plugin-runtime-types
51+
npm version "$VERSION" --no-git-tag-version --allow-same-version
52+
53+
- name: Build @yaakapp/api
54+
working-directory: packages/plugin-runtime-types
55+
run: npm run build
56+
57+
- name: Publish @yaakapp/api
58+
working-directory: packages/plugin-runtime-types
59+
run: npm publish --provenance --access public
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Generate Artifacts
1+
name: Release App Artifacts
22
on:
33
push:
44
tags: [v*]

crates-cli/yaak-cli/src/cli.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ use std::path::PathBuf;
44
#[derive(Parser)]
55
#[command(name = "yaak")]
66
#[command(about = "Yaak CLI - API client from the command line")]
7+
#[command(version)]
78
pub struct Cli {
89
/// Use a custom data directory
910
#[arg(long, global = true)]

npm/prepare-publish.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const { copyFileSync, existsSync, readFileSync, writeFileSync } = require("node:fs");
1+
const { chmodSync, copyFileSync, existsSync, readFileSync, writeFileSync } = require("node:fs");
22
const { join } = require("node:path");
33

44
const version = process.env.YAAK_CLI_VERSION?.replace(/^v/, "");
@@ -50,6 +50,9 @@ for (const { src, dest } of binaries) {
5050
process.exit(1);
5151
}
5252
copyFileSync(src, dest);
53+
if (!dest.endsWith(".exe")) {
54+
chmodSync(dest, 0o755);
55+
}
5356
}
5457

5558
for (const pkg of packages) {

package-lock.json

Lines changed: 29 additions & 29 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@
9898
"devDependencies": {
9999
"@biomejs/biome": "^2.3.13",
100100
"@tauri-apps/cli": "^2.9.6",
101-
"@yaakapp/cli": "^0.3.4",
101+
"@yaakapp/cli": "^0.4.0-beta.1",
102102
"dotenv-cli": "^11.0.0",
103103
"husky": "^9.1.7",
104104
"nodejs-file-downloader": "^4.13.0",

0 commit comments

Comments
 (0)