@akash-chowdhury-24/deployhub 1.0.1 → 1.0.6
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.md +228 -176
- package/install.ps1 +65 -55
- package/install.sh +99 -99
- package/package.json +93 -86
- package/src/adapters/dotnet.adapter.js +41 -41
- package/src/adapters/go.adapter.js +40 -40
- package/src/adapters/index.js +48 -48
- package/src/adapters/java.adapter.js +46 -46
- package/src/adapters/node.adapter.js +77 -77
- package/src/adapters/php.adapter.js +43 -43
- package/src/adapters/python.adapter.js +54 -54
- package/src/adapters/rails.adapter.js +66 -66
- package/src/artifact/engine.js +473 -473
- package/src/cli/index.js +45 -45
- package/src/commands/artifact.js +88 -88
- package/src/commands/build.js +44 -44
- package/src/commands/clean.js +50 -50
- package/src/commands/deploy.js +82 -82
- package/src/commands/doctor.js +630 -630
- package/src/commands/init.js +810 -795
- package/src/commands/logs.js +33 -33
- package/src/commands/rollback.js +50 -50
- package/src/commands/storage.js +116 -116
- package/src/commands/update.js +63 -63
- package/src/commands/verify.js +55 -55
- package/src/core/config.js +168 -168
- package/src/core/pipeline.js +77 -77
- package/src/core/stages.js +210 -210
- package/src/deployment/index.js +156 -156
- package/src/deployment/providers/azure-vm.js +7 -7
- package/src/deployment/providers/docker.js +30 -30
- package/src/deployment/providers/ec2.js +7 -7
- package/src/deployment/providers/gcp-vm.js +7 -7
- package/src/deployment/providers/kubernetes.js +30 -30
- package/src/deployment/providers/platforms/_shared.js +167 -167
- package/src/deployment/providers/platforms/aws-amplify.js +164 -164
- package/src/deployment/providers/platforms/azure-static-web-apps.js +68 -68
- package/src/deployment/providers/platforms/cloudflare-pages.js +103 -103
- package/src/deployment/providers/platforms/firebase-app-hosting.js +95 -95
- package/src/deployment/providers/platforms/firebase-hosting.js +99 -99
- package/src/deployment/providers/platforms/index.js +44 -44
- package/src/deployment/providers/platforms/netlify.js +102 -102
- package/src/deployment/providers/platforms/vercel.js +92 -92
- package/src/deployment/providers/ssh.js +365 -365
- package/src/detectors/angular.js +23 -23
- package/src/detectors/backend.detector.js +304 -304
- package/src/detectors/dotnet.js +18 -18
- package/src/detectors/frontend.detector.js +219 -219
- package/src/detectors/go.js +20 -20
- package/src/detectors/index.js +78 -78
- package/src/detectors/java.js +24 -24
- package/src/detectors/nextjs.js +23 -23
- package/src/detectors/node.js +28 -28
- package/src/detectors/php.js +17 -17
- package/src/detectors/python.js +22 -22
- package/src/detectors/react.js +29 -29
- package/src/detectors/vue.js +23 -23
- package/src/logger/index.js +44 -44
- package/src/notifications/email.js +53 -53
- package/src/notifications/index.js +34 -34
- package/src/notifications/slack.js +18 -18
- package/src/notifications/webhook.js +21 -21
- package/src/rollback/engine.js +102 -102
- package/src/storage/index.js +109 -109
- package/src/storage/providers/aws.js +96 -96
- package/src/storage/providers/azure.js +45 -45
- package/src/storage/providers/dropbox.js +49 -49
- package/src/storage/providers/ftp.js +69 -69
- package/src/storage/providers/gcp.js +45 -45
- package/src/storage/providers/gdrive.js +80 -80
- package/src/storage/providers/local.js +61 -61
- package/src/utils/author.js +154 -141
- package/src/utils/checksums.js +53 -53
- package/src/utils/firebase-config-generator.js +35 -35
- package/src/utils/github-actions.js +403 -403
- package/src/utils/init-platform.js +229 -229
- package/src/utils/nginx.js +34 -34
- package/src/utils/platform-env.js +132 -132
- package/src/utils/version.js +31 -31
package/README.md
CHANGED
|
@@ -1,176 +1,228 @@
|
|
|
1
|
-
# DeployHub
|
|
2
|
-
|
|
3
|
-
Zero-configuration deployment and artifact manager for Node.js projects. When you push to GitHub, DeployHub automatically detects your project type, builds it, creates a versioned artifact, uploads to cloud storage, and optionally deploys to your server.
|
|
4
|
-
|
|
5
|
-
## Installation
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
deployhub
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
##
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
`
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
1
|
+
# DeployHub
|
|
2
|
+
|
|
3
|
+
Zero-configuration deployment and artifact manager for Node.js projects. When you push to GitHub, DeployHub automatically detects your project type, builds it, creates a versioned artifact, uploads to cloud storage, and optionally deploys to your server.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
DeployHub can be installed via **npm** (requires Node.js 18+) or as a **standalone binary** (no Node.js required).
|
|
8
|
+
|
|
9
|
+
### npm (recommended for Node.js projects)
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install -g @akash-chowdhury-24/deployhub
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Or use locally in your project:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install @akash-chowdhury-24/deployhub
|
|
19
|
+
npx deployhub init
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### Standalone binary (Linux / macOS)
|
|
23
|
+
|
|
24
|
+
Downloads the latest release from [GitHub Releases](https://github.com/Akash-Chowdhury-24/DeployHub/releases) and installs to `/usr/local/bin` (or `~/.local/bin` without sudo):
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
curl -fsSL https://raw.githubusercontent.com/Akash-Chowdhury-24/DeployHub/main/install.sh | sh
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Supported platforms: Linux x64, macOS x64, macOS ARM64. If the binary download fails, the script falls back to `npm install -g`.
|
|
31
|
+
|
|
32
|
+
### Standalone binary (Windows)
|
|
33
|
+
|
|
34
|
+
Run in PowerShell:
|
|
35
|
+
|
|
36
|
+
```powershell
|
|
37
|
+
irm https://raw.githubusercontent.com/Akash-Chowdhury-24/DeployHub/main/install.ps1 | iex
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Installs to `%LOCALAPPDATA%\Programs\DeployHub` and adds it to your user PATH. On Windows ARM64, the script installs via npm instead (no native binary yet).
|
|
41
|
+
|
|
42
|
+
### Manual download
|
|
43
|
+
|
|
44
|
+
Pick the asset for your platform from the [latest release](https://github.com/Akash-Chowdhury-24/DeployHub/releases/latest):
|
|
45
|
+
|
|
46
|
+
| Platform | Asset |
|
|
47
|
+
|----------|-------|
|
|
48
|
+
| Linux x64 | `deployhub-linux-x64` |
|
|
49
|
+
| macOS x64 | `deployhub-macos-x64` |
|
|
50
|
+
| macOS ARM64 | `deployhub-macos-arm64` |
|
|
51
|
+
| Windows x64 | `deployhub-win.exe` |
|
|
52
|
+
|
|
53
|
+
Make it executable (Linux/macOS) and place it on your PATH:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
chmod +x deployhub-linux-x64
|
|
57
|
+
sudo mv deployhub-linux-x64 /usr/local/bin/deployhub
|
|
58
|
+
deployhub --version
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Verify installation
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
deployhub --version
|
|
65
|
+
deployhub doctor
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
To update an npm install: `deployhub update` or `npm install -g @akash-chowdhury-24/deployhub@latest`. For binary installs, re-run the install script or download the new release.
|
|
69
|
+
|
|
70
|
+
## Quick Start
|
|
71
|
+
|
|
72
|
+
### 1. Initialize
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
deployhub init
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
This interactive wizard will:
|
|
79
|
+
|
|
80
|
+
- Detect your framework (React, Vue, Next.js, Node, Python, etc.)
|
|
81
|
+
- Configure build commands and output directory
|
|
82
|
+
- Set up storage providers (AWS, Google Drive, Azure, GCP, Dropbox, Local)
|
|
83
|
+
- Optionally configure deployment targets (SSH, Docker, EC2, Kubernetes, etc.)
|
|
84
|
+
- Generate `deployhub.config.json`
|
|
85
|
+
- Generate `.github/workflows/deployhub.yml`
|
|
86
|
+
- Generate `.env.example`
|
|
87
|
+
|
|
88
|
+
### 2. Configure credentials
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
cp .env.example .env
|
|
92
|
+
# Edit .env with your credentials
|
|
93
|
+
|
|
94
|
+
deployhub storage add aws
|
|
95
|
+
deployhub storage add gdrive
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### 3. Run pre-flight checks
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
deployhub doctor
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### 4. Deploy
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
deployhub build
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Or push to `main` — GitHub Actions runs `deployhub build` automatically.
|
|
111
|
+
|
|
112
|
+
## Commands
|
|
113
|
+
|
|
114
|
+
| Command | Description |
|
|
115
|
+
|---------|-------------|
|
|
116
|
+
| `deployhub init` | Interactive project setup |
|
|
117
|
+
| `deployhub build` | Full pipeline: detect → install → test → build → artifact → storage → deploy |
|
|
118
|
+
| `deployhub artifact create` | Create artifact from current build |
|
|
119
|
+
| `deployhub artifact list` | List all artifacts |
|
|
120
|
+
| `deployhub artifact restore <version>` | Download and extract an artifact |
|
|
121
|
+
| `deployhub storage add <provider>` | Add storage provider credentials |
|
|
122
|
+
| `deployhub storage list` | List storage providers and connection status |
|
|
123
|
+
| `deployhub deploy` | Deploy latest artifact |
|
|
124
|
+
| `deployhub rollback [version]` | Rollback to a previous version |
|
|
125
|
+
| `deployhub logs` | Show logs from last deployment |
|
|
126
|
+
| `deployhub doctor` | Pre-flight checks |
|
|
127
|
+
| `deployhub verify` | Health check on configured endpoint |
|
|
128
|
+
| `deployhub clean` | Remove old local artifacts |
|
|
129
|
+
| `deployhub update` | Check for CLI updates |
|
|
130
|
+
|
|
131
|
+
## GitHub Secrets
|
|
132
|
+
|
|
133
|
+
Add these secrets in your repository (Settings → Secrets and variables → Actions). Only add secrets for providers you selected during `init`:
|
|
134
|
+
|
|
135
|
+
| Secret | Provider |
|
|
136
|
+
|--------|----------|
|
|
137
|
+
| `AWS_ACCESS_KEY_ID` | AWS S3 |
|
|
138
|
+
| `AWS_SECRET_ACCESS_KEY` | AWS S3 |
|
|
139
|
+
| `AWS_BUCKET` | AWS S3 |
|
|
140
|
+
| `AWS_REGION` | AWS S3 |
|
|
141
|
+
| `GDRIVE_CLIENT_ID` | Google Drive |
|
|
142
|
+
| `GDRIVE_CLIENT_SECRET` | Google Drive |
|
|
143
|
+
| `GDRIVE_REFRESH_TOKEN` | Google Drive |
|
|
144
|
+
| `GDRIVE_FOLDER_ID` | Google Drive |
|
|
145
|
+
| `AZURE_CONNECTION_STRING` | Azure Blob |
|
|
146
|
+
| `AZURE_CONTAINER` | Azure Blob |
|
|
147
|
+
| `GCP_PROJECT_ID` | GCP Storage |
|
|
148
|
+
| `GCP_KEY_FILE` | GCP Storage |
|
|
149
|
+
| `GCP_BUCKET` | GCP Storage |
|
|
150
|
+
| `DROPBOX_ACCESS_TOKEN` | Dropbox |
|
|
151
|
+
| `SSH_HOST` | SSH deployment |
|
|
152
|
+
| `SSH_USER` | SSH deployment |
|
|
153
|
+
| `SSH_KEY` | SSH deployment |
|
|
154
|
+
|
|
155
|
+
## `deployhub doctor` Output
|
|
156
|
+
|
|
157
|
+
The doctor command runs independent checks and always completes without crashing:
|
|
158
|
+
|
|
159
|
+
```
|
|
160
|
+
Checking Git... ✓ Git installed, repo detected, remote set
|
|
161
|
+
Checking Docker... ✓ Docker running
|
|
162
|
+
Checking Build command... ✓ "npm run build" found in package.json
|
|
163
|
+
Checking AWS... ✓ Credentials valid, bucket accessible
|
|
164
|
+
Checking Google Drive... ✓ Connected
|
|
165
|
+
Checking SSH target... ✓ Can reach host
|
|
166
|
+
Checking Health endpoint... ✓ URL reachable (HTTP 200)
|
|
167
|
+
Checking Secrets... ✓ All required env vars present
|
|
168
|
+
Checking GitHub Actions... ✓ Workflow file exists at .github/workflows/deployhub.yml
|
|
169
|
+
Checking Storage write... ✓ Test upload succeeded
|
|
170
|
+
|
|
171
|
+
✓ Ready to deploy (10/10 checks passed)
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
If checks fail:
|
|
175
|
+
|
|
176
|
+
```
|
|
177
|
+
Checking AWS... ✗ Missing: AWS_SECRET_ACCESS_KEY
|
|
178
|
+
Checking Health endpoint... ✗ No URL configured
|
|
179
|
+
|
|
180
|
+
8/10 — fix the 2 issues above before deploying
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
## Artifact Structure
|
|
184
|
+
|
|
185
|
+
Each build creates:
|
|
186
|
+
|
|
187
|
+
```
|
|
188
|
+
artifact/
|
|
189
|
+
{projectName}/
|
|
190
|
+
{YYYY-MM-DD}/
|
|
191
|
+
v{semver}/
|
|
192
|
+
artifact.zip
|
|
193
|
+
metadata.json
|
|
194
|
+
logs.txt
|
|
195
|
+
checksums.txt
|
|
196
|
+
deployment.json
|
|
197
|
+
release-notes.md
|
|
198
|
+
README.md
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
## Configuration
|
|
202
|
+
|
|
203
|
+
`deployhub.config.json` is generated by `init`. Credentials are **never** stored in this file — only in `.env` or GitHub Secrets.
|
|
204
|
+
|
|
205
|
+
## Pipeline Stages
|
|
206
|
+
|
|
207
|
+
1. **detect** — auto-detect project type
|
|
208
|
+
2. **install** — install dependencies
|
|
209
|
+
3. **test** — run test suite (skippable)
|
|
210
|
+
4. **build** — run build command
|
|
211
|
+
5. **docker** — build Docker image (skippable)
|
|
212
|
+
6. **artifact** — create artifact.zip + metadata
|
|
213
|
+
7. **storage** — upload to all configured providers (parallel)
|
|
214
|
+
8. **deploy** — deploy to configured targets
|
|
215
|
+
9. **verify** — health check after deployment
|
|
216
|
+
10. **notify** — send Slack/email/webhook notifications
|
|
217
|
+
|
|
218
|
+
## Author
|
|
219
|
+
|
|
220
|
+
**Akash Chowdhury**
|
|
221
|
+
📧 akashbumbac24@gmail.com
|
|
222
|
+
💼 [linkedin.com/in/akash-chowdhury-12141a222](https://www.linkedin.com/in/akash-chowdhury-12141a222/)
|
|
223
|
+
|
|
224
|
+
Built with ❤ — if DeployHub saves you time, feel free to connect on LinkedIn.
|
|
225
|
+
|
|
226
|
+
## License
|
|
227
|
+
|
|
228
|
+
MIT
|
package/install.ps1
CHANGED
|
@@ -1,55 +1,65 @@
|
|
|
1
|
-
# DeployHub install script for Windows
|
|
2
|
-
# Author: Akash Chowdhury — canonical source: src/utils/author.js
|
|
3
|
-
# Repository: https://github.com/Akash-Chowdhury-24/DeployHub
|
|
4
|
-
|
|
5
|
-
$ErrorActionPreference = "Stop"
|
|
6
|
-
|
|
7
|
-
$GitHubRepo = "Akash-Chowdhury-24/DeployHub"
|
|
8
|
-
$BinaryName = "deployhub.exe"
|
|
9
|
-
|
|
10
|
-
function Get-LatestVersion {
|
|
11
|
-
$release = Invoke-RestMethod -Uri "https://api.github.com/repos/$GitHubRepo/releases/latest"
|
|
12
|
-
return $release.tag_name
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
function Get-InstallDir {
|
|
16
|
-
$localBin = Join-Path $env:LOCALAPPDATA "Programs\DeployHub"
|
|
17
|
-
if (-not (Test-Path $localBin)) {
|
|
18
|
-
New-Item -ItemType Directory -Path $localBin -Force | Out-Null
|
|
19
|
-
}
|
|
20
|
-
return $localBin
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
function Add-ToPath {
|
|
24
|
-
param([string]$Dir)
|
|
25
|
-
$userPath = [Environment]::GetEnvironmentVariable("Path", "User")
|
|
26
|
-
if ($userPath -notlike "*$Dir*") {
|
|
27
|
-
[Environment]::SetEnvironmentVariable("Path", "$userPath;$Dir", "User")
|
|
28
|
-
$env:Path = "$env:Path;$Dir"
|
|
29
|
-
Write-Host "Added $Dir to user PATH"
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
try {
|
|
34
|
-
$
|
|
35
|
-
$
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}
|
|
1
|
+
# DeployHub install script for Windows
|
|
2
|
+
# Author: Akash Chowdhury — canonical source: src/utils/author.js
|
|
3
|
+
# Repository: https://github.com/Akash-Chowdhury-24/DeployHub
|
|
4
|
+
|
|
5
|
+
$ErrorActionPreference = "Stop"
|
|
6
|
+
|
|
7
|
+
$GitHubRepo = "Akash-Chowdhury-24/DeployHub"
|
|
8
|
+
$BinaryName = "deployhub.exe"
|
|
9
|
+
|
|
10
|
+
function Get-LatestVersion {
|
|
11
|
+
$release = Invoke-RestMethod -Uri "https://api.github.com/repos/$GitHubRepo/releases/latest"
|
|
12
|
+
return $release.tag_name
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function Get-InstallDir {
|
|
16
|
+
$localBin = Join-Path $env:LOCALAPPDATA "Programs\DeployHub"
|
|
17
|
+
if (-not (Test-Path $localBin)) {
|
|
18
|
+
New-Item -ItemType Directory -Path $localBin -Force | Out-Null
|
|
19
|
+
}
|
|
20
|
+
return $localBin
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function Add-ToPath {
|
|
24
|
+
param([string]$Dir)
|
|
25
|
+
$userPath = [Environment]::GetEnvironmentVariable("Path", "User")
|
|
26
|
+
if ($userPath -notlike "*$Dir*") {
|
|
27
|
+
[Environment]::SetEnvironmentVariable("Path", "$userPath;$Dir", "User")
|
|
28
|
+
$env:Path = "$env:Path;$Dir"
|
|
29
|
+
Write-Host "Added $Dir to user PATH"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
try {
|
|
34
|
+
$arch = $env:PROCESSOR_ARCHITECTURE
|
|
35
|
+
if ($arch -eq "ARM64") {
|
|
36
|
+
$binaryName = "deployhub-macos-arm64" # no Windows ARM64 binary yet
|
|
37
|
+
Write-Host "Windows ARM64 detected — no native binary available yet. Installing via npm instead..."
|
|
38
|
+
npm install -g @akash-chowdhury-24/deployhub@latest
|
|
39
|
+
exit 0
|
|
40
|
+
} else {
|
|
41
|
+
$binaryName = "deployhub-win.exe"
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
$version = Get-LatestVersion
|
|
45
|
+
$assetName = $binaryName
|
|
46
|
+
$url = "https://github.com/$GitHubRepo/releases/download/$version/$assetName"
|
|
47
|
+
$installDir = Get-InstallDir
|
|
48
|
+
$dest = Join-Path $installDir $BinaryName
|
|
49
|
+
|
|
50
|
+
Write-Host "Downloading DeployHub $version for Windows..."
|
|
51
|
+
Invoke-WebRequest -Uri $url -OutFile $dest -UseBasicParsing
|
|
52
|
+
|
|
53
|
+
if (-not (Test-Path $dest) -or (Get-Item $dest).Length -eq 0) {
|
|
54
|
+
throw "Binary download failed"
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
Add-ToPath $installDir
|
|
58
|
+
Write-Host "DeployHub $version installed to $dest"
|
|
59
|
+
& $dest --version
|
|
60
|
+
}
|
|
61
|
+
catch {
|
|
62
|
+
Write-Host "Binary install failed ($($_.Exception.Message)). Falling back to npm..." -ForegroundColor Yellow
|
|
63
|
+
npm install -g @akash-chowdhury-24/deployhub@latest
|
|
64
|
+
Write-Host "DeployHub installed via npm."
|
|
65
|
+
}
|