@invarn/cibuild 1.2.2 → 1.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.dev.md ADDED
@@ -0,0 +1,141 @@
1
+ # cibuild
2
+
3
+ Lightweight CI/CD pipeline runner for Android and iOS projects. Run your pipelines locally or on a remote runner using a simple YAML format.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ brew tap invarnhq/cibuild
9
+ brew install cibuild
10
+ ```
11
+
12
+ This installs two commands: `ci` and `cibuild` (both identical).
13
+
14
+ ## Getting Started
15
+
16
+ There are three ways to set up a pipeline in your project:
17
+
18
+ ### 1. Create (recommended)
19
+
20
+ Auto-detects your platform (iOS/Android), picks recommended build settings, and collects secrets from disk — fully non-interactive:
21
+
22
+ ```bash
23
+ ci init --create
24
+ ```
25
+
26
+ ### 2. Interactive
27
+
28
+ Walk through an interactive wizard to choose between creating or importing a pipeline:
29
+
30
+ ```bash
31
+ ci init
32
+ ```
33
+
34
+ ### 3. Import
35
+
36
+ Import an existing YAML pipeline file into your project:
37
+
38
+ ```bash
39
+ ci init --import path/to/pipeline.yml
40
+ ```
41
+
42
+ All three methods scaffold the `.ci/pipelines/` directory, validate dependencies, and add runtime files to `.gitignore`.
43
+
44
+ For the full pipeline YAML format, step catalog, and examples, see [SPEC.md](SPEC.md).
45
+
46
+ ## Commands
47
+
48
+ ```bash
49
+ ci init # Interactive setup wizard
50
+ ci init --create # Auto-create pipeline (non-interactive)
51
+ ci init --import <path> # Import YAML pipeline (non-interactive)
52
+ ci build # Generate a standard pipeline for the current project
53
+ ci run <path> [-w <name>] # Run locally (development mode)
54
+ ci run <path> [-w <name>] --production # Run on remote runner (production)
55
+ ci run <path> [-w <name>] --validate-only # Validate only, don't execute
56
+ ci run <path> [-w <name>] --skip-validation # Skip validation, run with interactive prompts
57
+ ci validate <path> [-w <name>] # Validate pipeline (alias for --validate-only)
58
+ ci detect-platform <path> [-w <name>] # Detect platform from YAML pipeline
59
+ ci edit <path> [-w <name>] # View pipeline and edit step inputs
60
+ ci secrets add <var_name> <path> [-w <name>] # Add a secret (prompted interactively)
61
+ ci --help # Show help
62
+ ```
63
+
64
+ ## Supported Formats
65
+
66
+ - `.yml` / `.yaml` — YAML pipeline files
67
+ - `.ts` — TypeScript pipeline files
68
+
69
+ ---
70
+
71
+ ## Development
72
+
73
+ ### Prerequisites
74
+
75
+ - Node.js 20+
76
+ - npm
77
+
78
+ ### Setup
79
+
80
+ ```bash
81
+ npm install
82
+ ```
83
+
84
+ ### Build (development)
85
+
86
+ Compiles TypeScript via `tsc` into `dist/src/`:
87
+
88
+ ```bash
89
+ npm run build
90
+ ```
91
+
92
+ ### Watch mode
93
+
94
+ ```bash
95
+ npm run dev
96
+ ```
97
+
98
+ ### Tests
99
+
100
+ ```bash
101
+ npm test
102
+ ```
103
+
104
+ ---
105
+
106
+ ## Release Builds
107
+
108
+ Two independent build pipelines exist depending on the distribution target.
109
+
110
+ ### Homebrew (native binary)
111
+
112
+ Bundles with esbuild, then compiles to a standalone macOS binary via `pkg`. No obfuscation — `pkg` embeds the JS inside the binary, which already protects the source. Obfuscation is intentionally skipped here because it encodes `require()` string arguments, breaking `pkg`'s static analysis.
113
+
114
+ ```bash
115
+ npm run release
116
+ # Outputs:
117
+ # dist/cibuild-macos-arm64.tar.gz
118
+ # dist/cibuild-macos-x64.tar.gz
119
+ ```
120
+
121
+ ### npm (obfuscated JS)
122
+
123
+ Bundles with esbuild, then obfuscates with `javascript-obfuscator` (base64 string encoding). Produces a single self-contained `.cjs` file.
124
+
125
+ ```bash
126
+ npm run build:npm
127
+ # Outputs:
128
+ # dist/cli.cjs (minified + string-obfuscated)
129
+ ```
130
+
131
+ ### Releasing a new version
132
+
133
+ Tagging and pushing a version tag triggers the GitHub Actions release workflow, which:
134
+ 1. Runs `npm run release` to build both macOS binaries
135
+ 2. Creates a release on `invarnhq/cibuild` with the binaries attached
136
+ 3. Auto-updates `Formula/cibuild.rb` in the public tap repo with the new version and SHA256 checksums
137
+
138
+ ```bash
139
+ git tag v1.0.0
140
+ git push origin v1.0.0
141
+ ```
package/README.md CHANGED
@@ -1,141 +1,154 @@
1
1
  # cibuild
2
2
 
3
- Lightweight CI/CD pipeline runner for Android and iOS projects. Run your pipelines locally or on a remote runner using a simple YAML format.
3
+ Lightweight CI/CD pipeline runner for Android and iOS projects. Define pipelines in YAML, run them locally or on a remote runner.
4
4
 
5
5
  ## Install
6
6
 
7
7
  ```bash
8
- brew tap invarnhq/cibuild
9
- brew install cibuild
8
+ npm install -g @invarn/cibuild
10
9
  ```
11
10
 
12
- This installs two commands: `ci` and `cibuild` (both identical).
11
+ This installs two identical commands: `ci` and `cibuild`.
13
12
 
14
13
  ## Getting Started
15
14
 
16
- There are three ways to set up a pipeline in your project:
15
+ ### Option 1. Auto-create (recommended)
17
16
 
18
- ### 1. Create (recommended)
19
-
20
- Auto-detects your platform (iOS/Android), picks recommended build settings, and collects secrets from disk — fully non-interactive:
17
+ From your project root, let cibuild scan the project and generate a pipeline with recommended defaults:
21
18
 
22
19
  ```bash
23
20
  ci init --create
24
21
  ```
25
22
 
26
- ### 2. Interactive
23
+ This auto-detects the platform (iOS/Android), configures build settings, and collects secrets from disk — fully non-interactive, works with AI agents and scripts.
24
+
25
+ ### Option 2. Interactive wizard
27
26
 
28
- Walk through an interactive wizard to choose between creating or importing a pipeline:
27
+ Walk through prompts to configure your pipeline step by step:
29
28
 
30
29
  ```bash
31
30
  ci init
32
31
  ```
33
32
 
34
- ### 3. Import
33
+ ### Option 3. Import existing pipeline
35
34
 
36
- Import an existing YAML pipeline file into your project:
35
+ If you already have a pipeline YAML file:
37
36
 
38
37
  ```bash
39
38
  ci init --import path/to/pipeline.yml
40
39
  ```
41
40
 
42
- All three methods scaffold the `.ci/pipelines/` directory, validate dependencies, and add runtime files to `.gitignore`.
43
-
44
- For the full pipeline YAML format, step catalog, and examples, see [SPEC.md](SPEC.md).
41
+ All three methods scaffold the `.ci/pipelines/` directory, validate dependencies, and set up `.gitignore`.
45
42
 
46
- ## Commands
43
+ ### Customize
47
44
 
48
- ```bash
49
- ci init # Interactive setup wizard
50
- ci init --create # Auto-create pipeline (non-interactive)
51
- ci init --import <path> # Import YAML pipeline (non-interactive)
52
- ci build # Generate a standard pipeline for the current project
53
- ci run <path> [-w <name>] # Run locally (development mode)
54
- ci run <path> [-w <name>] --production # Run on remote runner (production)
55
- ci run <path> [-w <name>] --validate-only # Validate only, don't execute
56
- ci run <path> [-w <name>] --skip-validation # Skip validation, run with interactive prompts
57
- ci validate <path> [-w <name>] # Validate pipeline (alias for --validate-only)
58
- ci detect-platform <path> [-w <name>] # Detect platform from YAML pipeline
59
- ci edit <path> [-w <name>] # View pipeline and edit step inputs
60
- ci secrets add <var_name> <path> [-w <name>] # Add a secret (prompted interactively)
61
- ci --help # Show help
62
- ```
45
+ cibuild works best when you start with `ci init --create` and build on top of the generated pipeline. The full pipeline format, step catalog, and customization rules are in the spec.
63
46
 
64
- ## Supported Formats
47
+ Tell your AI coding agent:
65
48
 
66
- - `.yml` / `.yaml` YAML pipeline files
67
- - `.ts` — TypeScript pipeline files
49
+ > Set up and customize CI/CD pipelines for this project using cibuild according to the following spec: https://github.com/invarnhq/cibuild/blob/main/SPEC.md
68
50
 
69
- ---
70
-
71
- ## Development
72
-
73
- ### Prerequisites
74
-
75
- - Node.js 20+
76
- - npm
77
-
78
- ### Setup
51
+ ### Run
79
52
 
80
53
  ```bash
81
- npm install
54
+ ci run # Run the default pipeline
55
+ ci run .ci/pipelines/cibuild.yml -w release # Run a specific workflow
82
56
  ```
83
57
 
84
- ### Build (development)
58
+ ## Commands
85
59
 
86
- Compiles TypeScript via `tsc` into `dist/src/`:
60
+ | Command | Description |
61
+ |---|---|
62
+ | `ci init` | Interactive setup wizard |
63
+ | `ci init --create` | Auto-create pipeline (non-interactive) |
64
+ | `ci init --import <path>` | Import YAML pipeline (non-interactive) |
65
+ | `ci build` | Generate a standard pipeline for the current project |
66
+ | `ci run <path> [-w <name>]` | Run pipeline locally (development mode) |
67
+ | `ci run <path> [-w <name>] --production` | Run on remote runner (production) |
68
+ | `ci run <path> [-w <name>] --validate-only` | Validate only, don't execute |
69
+ | `ci run <path> [-w <name>] --skip-validation` | Skip validation, run with interactive prompts |
70
+ | `ci validate <path> [-w <name>]` | Validate pipeline (alias for --validate-only) |
71
+ | `ci detect-platform <path> [-w <name>]` | Detect platform from YAML pipeline |
72
+ | `ci edit <path> [-w <name>]` | View pipeline and edit step inputs |
73
+ | `ci secrets add <var> <path> [-w <name>]` | Add a secret (prompted interactively) |
74
+ | `ci secrets add <var> <path> --file <file>` | Add a secret from a file |
75
+ | `ci --help` | Show help |
76
+
77
+ ### Options
78
+
79
+ | Flag | Description |
80
+ |---|---|
81
+ | `-w, --workflow <name>` | Select a workflow (YAML pipelines only, defaults to first) |
82
+ | `--production` | Execute on remote runner after validation (vs local) |
83
+ | `--validate-only` | Run validation only, don't execute pipeline |
84
+ | `--skip-validation` | Skip pre-execution validation (for development) |
85
+
86
+ ## Secrets
87
+
88
+ Secrets are stored locally in `.cibuild-secrets.json` and never committed.
87
89
 
88
90
  ```bash
89
- npm run build
91
+ ci secrets add KEYSTORE_PASSWORD pipeline.yml
92
+ ci secrets add KEYSTORE_BASE64 pipeline.yml --file release.keystore
93
+ ci secrets add SLACK_WEBHOOK pipeline.yml -w release
90
94
  ```
91
95
 
92
- ### Watch mode
96
+ ## GitHub Actions
93
97
 
94
- ```bash
95
- npm run dev
96
- ```
98
+ Use cibuild directly in your GitHub Actions workflows:
97
99
 
98
- ### Tests
100
+ ```yaml
101
+ name: CI
102
+ on: [push, pull_request]
99
103
 
100
- ```bash
101
- npm test
104
+ jobs:
105
+ build:
106
+ runs-on: macos-latest
107
+ environment: cibuild
108
+ steps:
109
+ - uses: actions/checkout@v4
110
+ - uses: invarnhq/cibuild@v1
111
+ with:
112
+ workflow: release
102
113
  ```
103
114
 
104
- ---
115
+ ### Action Inputs
105
116
 
106
- ## Release Builds
117
+ | Input | Required | Default | Description |
118
+ |---|---|---|---|
119
+ | `pipeline` | No | Auto-discover | Path to pipeline YAML file |
120
+ | `workflow` | No | First workflow | Workflow name within the pipeline |
121
+ | `version` | No | `latest` | cibuild version to install |
107
122
 
108
- Two independent build pipelines exist depending on the distribution target.
123
+ ### Secrets in GitHub Actions
109
124
 
110
- ### Homebrew (native binary)
111
-
112
- Bundles with esbuild, then compiles to a standalone macOS binary via `pkg`. No obfuscation — `pkg` embeds the JS inside the binary, which already protects the source. Obfuscation is intentionally skipped here because it encodes `require()` string arguments, breaking `pkg`'s static analysis.
125
+ Upload your local secrets to a GitHub Environment, then reference them in your workflow:
113
126
 
114
127
  ```bash
115
- npm run release
116
- # Outputs:
117
- # dist/cibuild-macos-arm64.tar.gz
118
- # dist/cibuild-macos-x64.tar.gz
128
+ ci secrets upload --env cibuild
119
129
  ```
120
130
 
121
- ### npm (obfuscated JS)
122
-
123
- Bundles with esbuild, then obfuscates with `javascript-obfuscator` (base64 string encoding). Produces a single self-contained `.cjs` file.
124
-
125
- ```bash
126
- npm run build:npm
127
- # Outputs:
128
- # dist/cli.cjs (minified + string-obfuscated)
131
+ ```yaml
132
+ jobs:
133
+ build:
134
+ runs-on: macos-latest
135
+ environment: cibuild
136
+ env:
137
+ CIBUILD_S__SLACK_WEBHOOK: ${{ secrets.CIBUILD_S__SLACK_WEBHOOK }}
138
+ CIBUILD_SW__RELEASE__KEYSTORE_PASS: ${{ secrets.CIBUILD_SW__RELEASE__KEYSTORE_PASS }}
139
+ steps:
140
+ - uses: actions/checkout@v4
141
+ - uses: invarnhq/cibuild@v1
142
+ with:
143
+ workflow: release
129
144
  ```
130
145
 
131
- ### Releasing a new version
146
+ The action automatically maps GitHub context to cibuild environment variables (`GIT_BRANCH`, `GIT_COMMIT`, `BUILD_NUMBER`, `BUILD_URL`).
132
147
 
133
- Tagging and pushing a version tag triggers the GitHub Actions release workflow, which:
134
- 1. Runs `npm run release` to build both macOS binaries
135
- 2. Creates a release on `invarnhq/cibuild` with the binaries attached
136
- 3. Auto-updates `Formula/cibuild.rb` in the public tap repo with the new version and SHA256 checksums
148
+ ## Requirements
137
149
 
138
- ```bash
139
- git tag v1.0.0
140
- git push origin v1.0.0
141
- ```
150
+ - macOS or Linux (Node.js 18+ for npm install)
151
+ - Android projects: JDK, Android SDK
152
+ - iOS projects: macOS with Xcode (CocoaPods optional)
153
+
154
+ Run `ci init` from your project root to check all dependencies automatically.