github-archiver 1.0.7 → 1.0.8
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/CHANGELOG.md +2 -0
- package/README.md +82 -254
- package/docs/RELEASE.md +123 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -4,23 +4,21 @@
|
|
|
4
4
|
[](https://www.npmjs.com/package/github-archiver)
|
|
5
5
|
[](https://github.com/semantic-release/semantic-release)
|
|
6
6
|
|
|
7
|
-
A powerful
|
|
7
|
+
A powerful CLI for mass archiving GitHub repositories with parallel processing and comprehensive error handling.
|
|
8
8
|
|
|
9
9
|
## Features
|
|
10
10
|
|
|
11
|
-
✨ **Mass Archive
|
|
12
|
-
🔐 **Secure
|
|
13
|
-
⚡ **Parallel Processing** -
|
|
14
|
-
📋 **
|
|
15
|
-
🔍 **Validation** - Dry-run mode to validate without archiving
|
|
16
|
-
📊 **Progress Tracking** - Real-time progress bars and ETA
|
|
17
|
-
🛡️ **Error Recovery** - Comprehensive error handling with helpful guidance
|
|
18
|
-
📝 **Detailed Logging** - Structured logging to files and console
|
|
11
|
+
- ✨ **Mass Archive** - Archive multiple repositories in parallel
|
|
12
|
+
- 🔐 **Secure Auth** - Token stored locally at `~/.github-archiver/config.json`
|
|
13
|
+
- ⚡ **Parallel Processing** - Configurable concurrency (1-50)
|
|
14
|
+
- 📋 **Flexible Input** - Load repos from editor, file, or stdin
|
|
15
|
+
- 🔍 **Validation** - Dry-run mode to validate without archiving
|
|
16
|
+
- 📊 **Progress Tracking** - Real-time progress bars and ETA
|
|
17
|
+
- 🛡️ **Error Recovery** - Comprehensive error handling with helpful guidance
|
|
18
|
+
- 📝 **Detailed Logging** - Structured logging to files and console
|
|
19
19
|
|
|
20
20
|
## Installation
|
|
21
21
|
|
|
22
|
-
### npm
|
|
23
|
-
|
|
24
22
|
```bash
|
|
25
23
|
npm install -g github-archiver
|
|
26
24
|
```
|
|
@@ -30,8 +28,7 @@ npm install -g github-archiver
|
|
|
30
28
|
```bash
|
|
31
29
|
git clone https://github.com/mynameistito/github-archiver.git
|
|
32
30
|
cd github-archiver
|
|
33
|
-
npm install
|
|
34
|
-
npm run build
|
|
31
|
+
npm install && npm run build
|
|
35
32
|
npm install -g .
|
|
36
33
|
```
|
|
37
34
|
|
|
@@ -44,18 +41,12 @@ npm run dev -- <command>
|
|
|
44
41
|
|
|
45
42
|
## Quick Start
|
|
46
43
|
|
|
47
|
-
### 1. Authenticate with GitHub
|
|
48
|
-
|
|
49
44
|
```bash
|
|
45
|
+
# Authenticate
|
|
50
46
|
github-archiver auth login
|
|
51
|
-
# Paste your GitHub Personal Access Token when prompted
|
|
52
|
-
```
|
|
53
47
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
```bash
|
|
48
|
+
# Archive (opens editor to input repos)
|
|
57
49
|
github-archiver archive
|
|
58
|
-
# Opens your default text editor to enter repository URLs
|
|
59
50
|
```
|
|
60
51
|
|
|
61
52
|
## Commands
|
|
@@ -64,101 +55,61 @@ github-archiver archive
|
|
|
64
55
|
|
|
65
56
|
Manage GitHub authentication.
|
|
66
57
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
#### `auth logout`
|
|
75
|
-
Remove stored GitHub token.
|
|
76
|
-
|
|
77
|
-
```bash
|
|
78
|
-
github-archiver auth logout
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
#### `auth status`
|
|
82
|
-
Check current authentication status.
|
|
83
|
-
|
|
84
|
-
```bash
|
|
85
|
-
github-archiver auth status
|
|
86
|
-
```
|
|
58
|
+
| Command | Description |
|
|
59
|
+
|---------|-------------|
|
|
60
|
+
| `auth login` | Authenticate with Personal Access Token |
|
|
61
|
+
| `auth logout` | Remove stored token |
|
|
62
|
+
| `auth status` | Check authentication status |
|
|
87
63
|
|
|
88
64
|
### `archive`
|
|
89
65
|
|
|
90
|
-
Archive multiple
|
|
66
|
+
Archive multiple repositories.
|
|
91
67
|
|
|
92
68
|
```bash
|
|
93
69
|
github-archiver archive [options]
|
|
94
70
|
```
|
|
95
71
|
|
|
96
|
-
#### Options
|
|
97
|
-
|
|
98
72
|
| Option | Default | Description |
|
|
99
73
|
|--------|---------|-------------|
|
|
100
74
|
| `--file <path>` | - | Read repository URLs from file |
|
|
101
|
-
| `--stdin` | - | Read
|
|
75
|
+
| `--stdin` | - | Read from stdin |
|
|
102
76
|
| `--dry-run` | false | Validate without archiving |
|
|
103
|
-
| `--concurrency <n>` | 3 |
|
|
77
|
+
| `--concurrency <n>` | 3 | Parallel operations (1-50) |
|
|
104
78
|
| `--timeout <n>` | 300 | API timeout in seconds (10-3600) |
|
|
105
79
|
| `--verbose` | false | Enable verbose logging |
|
|
106
80
|
| `--force` | false | Skip confirmation prompts |
|
|
107
81
|
|
|
108
|
-
|
|
82
|
+
**Examples:**
|
|
109
83
|
|
|
110
|
-
**Interactive (opens editor):**
|
|
111
84
|
```bash
|
|
85
|
+
# Interactive (opens editor)
|
|
112
86
|
github-archiver archive
|
|
113
|
-
```
|
|
114
87
|
|
|
115
|
-
|
|
116
|
-
```bash
|
|
88
|
+
# From file
|
|
117
89
|
github-archiver archive --file repos.txt
|
|
118
|
-
```
|
|
119
90
|
|
|
120
|
-
|
|
121
|
-
```bash
|
|
91
|
+
# From stdin
|
|
122
92
|
cat repos.txt | github-archiver archive --stdin
|
|
123
|
-
```
|
|
124
93
|
|
|
125
|
-
|
|
126
|
-
```bash
|
|
94
|
+
# Dry-run
|
|
127
95
|
github-archiver archive --file repos.txt --dry-run
|
|
128
|
-
```
|
|
129
96
|
|
|
130
|
-
|
|
131
|
-
```bash
|
|
97
|
+
# High concurrency
|
|
132
98
|
github-archiver archive --file repos.txt --concurrency 10
|
|
133
|
-
```
|
|
134
99
|
|
|
135
|
-
|
|
136
|
-
```bash
|
|
100
|
+
# Force without confirmation
|
|
137
101
|
github-archiver archive --file repos.txt --force
|
|
138
102
|
```
|
|
139
103
|
|
|
140
104
|
## Input Format
|
|
141
105
|
|
|
142
|
-
|
|
106
|
+
Supported formats:
|
|
143
107
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
https://github.com/owner/repo.git
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
### SSH Format
|
|
151
|
-
```
|
|
152
|
-
git@github.com:owner/repo.git
|
|
153
|
-
git@github.com:owner/repo
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
### Shorthand Format
|
|
157
|
-
```
|
|
158
|
-
owner/repo
|
|
159
|
-
```
|
|
108
|
+
- HTTPS: `https://github.com/owner/repo` or `https://github.com/owner/repo.git`
|
|
109
|
+
- SSH: `git@github.com:owner/repo.git` or `git@github.com:owner/repo`
|
|
110
|
+
- Shorthand: `owner/repo`
|
|
160
111
|
|
|
161
|
-
|
|
112
|
+
**File Example:**
|
|
162
113
|
|
|
163
114
|
```
|
|
164
115
|
# Repositories to archive
|
|
@@ -166,22 +117,16 @@ https://github.com/facebook/react
|
|
|
166
117
|
torvalds/linux
|
|
167
118
|
owner/private-repo
|
|
168
119
|
|
|
169
|
-
# Comments
|
|
120
|
+
# Comments ignored
|
|
170
121
|
https://github.com/nodejs/node
|
|
171
122
|
```
|
|
172
123
|
|
|
173
124
|
## GitHub Token Requirements
|
|
174
125
|
|
|
175
|
-
You need a GitHub Personal Access Token with the following:
|
|
176
|
-
|
|
177
126
|
- **Scope**: `repo` (Full control of private repositories)
|
|
178
|
-
- **Minimum Permissions**: Push access to repositories
|
|
179
|
-
|
|
180
|
-
### How to Generate a Token
|
|
127
|
+
- **Minimum Permissions**: Push access to target repositories
|
|
181
128
|
|
|
182
|
-
|
|
183
|
-
2. Create a new token with `repo` scope
|
|
184
|
-
3. Copy the token and run `github-archiver auth login`
|
|
129
|
+
**Generate token:** https://github.com/settings/tokens/new → Create with `repo` scope → Run `github-archiver auth login`
|
|
185
130
|
|
|
186
131
|
## Output Example
|
|
187
132
|
|
|
@@ -219,225 +164,108 @@ Starting to archive repositories... (concurrency: 3)
|
|
|
219
164
|
|
|
220
165
|
## Troubleshooting
|
|
221
166
|
|
|
222
|
-
### Authentication
|
|
167
|
+
### Authentication
|
|
223
168
|
|
|
224
|
-
**
|
|
225
|
-
- Run: `github-archiver auth login`
|
|
226
|
-
- Ensure you have a valid Personal Access Token with `repo` scope
|
|
169
|
+
**No token found**: Run `github-archiver auth login`
|
|
227
170
|
|
|
228
|
-
**
|
|
229
|
-
- Generate a new token at https://github.com/settings/tokens
|
|
230
|
-
- Run: `github-archiver auth logout` then `github-archiver auth login`
|
|
171
|
+
**Invalid/expired token**: Generate new token at https://github.com/settings/tokens → `auth logout` → `auth login`
|
|
231
172
|
|
|
232
|
-
###
|
|
173
|
+
### Permissions
|
|
233
174
|
|
|
234
|
-
**
|
|
235
|
-
- Verify you are the repository owner or have push access
|
|
236
|
-
- Check that your token has the `repo` scope
|
|
237
|
-
- The repository must not be archived yet
|
|
175
|
+
**Permission denied**: Verify repo ownership/push access, check `repo` scope, ensure repo isn't already archived
|
|
238
176
|
|
|
239
177
|
### Rate Limiting
|
|
240
178
|
|
|
241
|
-
**
|
|
242
|
-
- Wait a few minutes (rate limit resets hourly)
|
|
243
|
-
- Use lower concurrency: `--concurrency 1`
|
|
244
|
-
- Increase timeout: `--timeout 600`
|
|
179
|
+
**Rate limit exceeded**: Wait (resets hourly), lower `--concurrency 1`, increase `--timeout 600`
|
|
245
180
|
|
|
246
|
-
### Network
|
|
181
|
+
### Network
|
|
247
182
|
|
|
248
|
-
**
|
|
249
|
-
- Check your internet connection
|
|
250
|
-
- GitHub API may be temporarily unavailable
|
|
251
|
-
- Try again in a moment
|
|
252
|
-
- Increase timeout: `--timeout 600`
|
|
183
|
+
**Network error/timeout**: Check connection, GitHub API may be unavailable, retry with `--timeout 600`
|
|
253
184
|
|
|
254
185
|
### Repository Not Found
|
|
255
186
|
|
|
256
|
-
**
|
|
257
|
-
- Verify the repository URL is correct
|
|
258
|
-
- The repository may have been deleted
|
|
259
|
-
- Check your GitHub access to the repository
|
|
187
|
+
**Repository not found**: Verify URL, check if deleted, confirm GitHub access
|
|
260
188
|
|
|
261
189
|
## Configuration
|
|
262
190
|
|
|
263
|
-
|
|
264
|
-
- **Linux/macOS**: `~/.github-archiver/config.json`
|
|
265
|
-
- **Windows**: `%USERPROFILE%\.github-archiver\config.json`
|
|
191
|
+
**Config**: `~/.github-archiver/config.json` (Linux/macOS) or `%USERPROFILE%\.github-archiver\config.json` (Windows)
|
|
266
192
|
|
|
267
|
-
Logs
|
|
268
|
-
- **Linux/macOS**: `~/.github-archiver/logs/`
|
|
269
|
-
- **Windows**: `%USERPROFILE%\.github-archiver\logs\`
|
|
193
|
+
**Logs**: `~/.github-archiver/logs/` (Linux/macOS) or `%USERPROFILE%\.github-archiver\logs\` (Windows)
|
|
270
194
|
|
|
271
195
|
## Architecture
|
|
272
196
|
|
|
273
197
|
```
|
|
274
198
|
src/
|
|
275
|
-
├── commands/
|
|
276
|
-
├── services/
|
|
277
|
-
├── utils/
|
|
278
|
-
├── types/
|
|
279
|
-
└── constants/
|
|
199
|
+
├── commands/ # CLI commands (auth, archive)
|
|
200
|
+
├── services/ # GitHub API, archiving, auth management
|
|
201
|
+
├── utils/ # Parsing, formatting, logging
|
|
202
|
+
├── types/ # TypeScript definitions
|
|
203
|
+
└── constants/ # Configuration constants
|
|
280
204
|
|
|
281
205
|
tests/
|
|
282
|
-
└── unit/
|
|
206
|
+
└── unit/ # Unit tests
|
|
283
207
|
```
|
|
284
208
|
|
|
285
|
-
|
|
209
|
+
**Core Services:**
|
|
286
210
|
|
|
287
|
-
- **GitHubService**:
|
|
288
|
-
- **Archiver**:
|
|
289
|
-
- **AuthManager**:
|
|
290
|
-
- **InputHandler**:
|
|
291
|
-
- **ProgressDisplay**:
|
|
211
|
+
- **GitHubService**: GitHub API interactions with retry logic
|
|
212
|
+
- **Archiver**: Parallel archiving with p-queue
|
|
213
|
+
- **AuthManager**: Secure token storage
|
|
214
|
+
- **InputHandler**: Input from editor, file, or stdin
|
|
215
|
+
- **ProgressDisplay**: Progress bar and summary output
|
|
292
216
|
|
|
293
217
|
## Development
|
|
294
218
|
|
|
295
|
-
### Setup
|
|
296
|
-
|
|
297
219
|
```bash
|
|
298
220
|
npm install
|
|
299
|
-
npm run typecheck
|
|
300
|
-
npm run test
|
|
301
|
-
npm run build
|
|
221
|
+
npm run typecheck # Check TypeScript
|
|
222
|
+
npm run test # Run unit tests
|
|
223
|
+
npm run build # Build production bundle
|
|
224
|
+
npm run lint # Check code style
|
|
225
|
+
npm run format # Auto-format code
|
|
302
226
|
```
|
|
303
227
|
|
|
304
|
-
### Commands
|
|
305
|
-
|
|
306
|
-
| Command | Description |
|
|
307
|
-
|---------|-------------|
|
|
308
|
-
| `npm run dev -- <cmd>` | Run CLI in development mode |
|
|
309
|
-
| `npm run typecheck` | Check TypeScript compilation |
|
|
310
|
-
| `npm run test` | Run unit tests |
|
|
311
|
-
| `npm run build` | Build production bundle |
|
|
312
|
-
| `npm run lint` | Check code style |
|
|
313
|
-
| `npm run format` | Auto-format code |
|
|
314
|
-
|
|
315
228
|
### Code Standards
|
|
316
229
|
|
|
317
|
-
This project uses **Ultracite
|
|
318
|
-
|
|
319
|
-
-
|
|
320
|
-
-
|
|
321
|
-
- Consistent formatting via Biome
|
|
230
|
+
This project uses **Ultracite** (Biome) for:
|
|
231
|
+
- Strict TypeScript (no implicit `any`)
|
|
232
|
+
- Accessibility, performance, security best practices
|
|
233
|
+
- Consistent formatting
|
|
322
234
|
- Comprehensive error handling
|
|
323
235
|
|
|
324
|
-
See `AGENTS.md` for
|
|
325
|
-
|
|
326
|
-
### Testing
|
|
327
|
-
|
|
328
|
-
```bash
|
|
329
|
-
npm run test # Run all tests
|
|
330
|
-
npm run test:coverage # Run with coverage report
|
|
331
|
-
```
|
|
236
|
+
See `AGENTS.md` for details.
|
|
332
237
|
|
|
333
238
|
## Release Process
|
|
334
239
|
|
|
335
|
-
This project uses **semantic-release** for automated versioning and publishing
|
|
336
|
-
|
|
337
|
-
### How Releases Work
|
|
338
|
-
|
|
339
|
-
1. **Commit Format**: Use [Conventional Commits](https://www.conventionalcommits.org/):
|
|
340
|
-
- `feat:` - New features → **minor** version bump (1.0.0 → 1.1.0)
|
|
341
|
-
- `fix:` - Bug fixes → **patch** version bump (1.0.0 → 1.0.1)
|
|
342
|
-
- `BREAKING CHANGE:` - Breaking changes → **major** version bump (1.0.0 → 2.0.0)
|
|
343
|
-
- `chore:`, `docs:`, `test:` - No version bump
|
|
344
|
-
|
|
345
|
-
2. **Automatic Trigger**:
|
|
346
|
-
- Push to `main` branch triggers the release workflow
|
|
347
|
-
- Semantic release analyzes commits and determines version bump
|
|
348
|
-
- Package version is updated, published to npm
|
|
349
|
-
- GitHub release is created with changelog
|
|
350
|
-
- Git tag is created automatically
|
|
351
|
-
|
|
352
|
-
3. **Trusted Publishing**:
|
|
353
|
-
- Uses OpenID Connect (OIDC) for secure, tokenless authentication
|
|
354
|
-
- No npm tokens required - eliminates security risks
|
|
355
|
-
- Short-lived, cryptographically-signed tokens for each publish
|
|
356
|
-
- Works with personal GitHub accounts
|
|
357
|
-
|
|
358
|
-
4. **Node Version Requirements**:
|
|
359
|
-
- Package runs on Node 18+ (see `package.json` engines)
|
|
360
|
-
- Release workflow uses Node 22+ (semantic-release requirement)
|
|
361
|
-
- CI tests on Node 18 and 22 for maximum compatibility
|
|
362
|
-
|
|
363
|
-
5. **Example Workflow**:
|
|
364
|
-
```bash
|
|
365
|
-
git checkout main
|
|
366
|
-
git pull
|
|
367
|
-
# Make your commits with conventional format
|
|
368
|
-
git commit -m "feat: add support for custom config file"
|
|
369
|
-
git push
|
|
370
|
-
# Release happens automatically!
|
|
371
|
-
```
|
|
372
|
-
|
|
373
|
-
### Trusted Publishing Setup
|
|
374
|
-
|
|
375
|
-
This project uses npm's **Trusted Publishing** feature for secure, tokenless package publishing.
|
|
376
|
-
|
|
377
|
-
**Setup (one-time):**
|
|
378
|
-
1. Go to https://www.npmjs.com/package/github-archiver/settings
|
|
379
|
-
2. Under **Trusted Publisher**, click **GitHub Actions**
|
|
380
|
-
3. Fill in:
|
|
381
|
-
- **Organization or user**: `mynameistito`
|
|
382
|
-
- **Repository**: `github-archiver`
|
|
383
|
-
- **Workflow filename**: `release.yml`
|
|
384
|
-
4. Click **Set up connection**
|
|
385
|
-
5. (Recommended) Enable **"Require two-factor authentication and disallow tokens"**
|
|
386
|
-
|
|
387
|
-
That's it! No tokens to manage, rotate, or worry about.</think></tool_call>
|
|
388
|
-
|
|
389
|
-
### Commit Message Examples
|
|
240
|
+
This project uses **semantic-release** for automated versioning and publishing.
|
|
390
241
|
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
git commit -m "fix: handle empty repository list gracefully"
|
|
242
|
+
**Commit format** (Conventional Commits):
|
|
243
|
+
- `feat:` → minor bump
|
|
244
|
+
- `fix:` → patch bump
|
|
245
|
+
- `BREAKING CHANGE:` → major bump
|
|
246
|
+
- `chore:`, `docs:`, `test:` → no bump
|
|
397
247
|
|
|
398
|
-
|
|
399
|
-
git commit -m "feat!: change CLI command structure
|
|
400
|
-
|
|
401
|
-
BREAKING CHANGE: The 'auth' subcommand is now required"
|
|
402
|
-
|
|
403
|
-
# No release
|
|
404
|
-
git commit -m "chore: update dependencies"
|
|
405
|
-
git commit -m "docs: clarify installation steps"
|
|
406
|
-
git commit -m "test: add unit tests for parser"
|
|
407
|
-
```
|
|
408
|
-
|
|
409
|
-
### Manual Releases
|
|
410
|
-
|
|
411
|
-
If you need to publish without merging to main:
|
|
412
|
-
```bash
|
|
413
|
-
npm run release -- --no-ci
|
|
414
|
-
```
|
|
248
|
+
Pushing to `main` triggers automatic release. See [docs/RELEASE.md](docs/RELEASE.md) for detailed setup and workflow.
|
|
415
249
|
|
|
416
250
|
## Contributing
|
|
417
251
|
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
1. Follow the code standards (run `npm run format`)
|
|
252
|
+
1. Follow code standards (`npm run format`)
|
|
421
253
|
2. Add tests for new features
|
|
422
254
|
3. Ensure `npm run typecheck` and `npm run test` pass
|
|
423
|
-
4. Create
|
|
255
|
+
4. Create pull request with clear description
|
|
424
256
|
|
|
425
257
|
## License
|
|
426
258
|
|
|
427
|
-
MIT - See LICENSE file for details
|
|
259
|
+
MIT - See LICENSE file for details.
|
|
428
260
|
|
|
429
261
|
## Support
|
|
430
262
|
|
|
431
|
-
|
|
263
|
+
Check the [Troubleshooting](#troubleshooting) section or open an issue on GitHub.
|
|
432
264
|
|
|
433
265
|
## Acknowledgments
|
|
434
266
|
|
|
435
|
-
|
|
436
|
-
- Uses Biome for code formatting and linting
|
|
437
|
-
- Inspired by the need for efficient GitHub repository management
|
|
438
|
-
|
|
439
|
-
## Version
|
|
267
|
+
Built with TypeScript, Commander.js, Octokit, Winston, and Biome.
|
|
440
268
|
|
|
441
|
-
|
|
269
|
+
---
|
|
442
270
|
|
|
443
|
-
|
|
271
|
+
Current version: 1.0.0 | [Releases](https://github.com/mynameistito/github-archiver/releases)
|
package/docs/RELEASE.md
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# Release Process
|
|
2
|
+
|
|
3
|
+
This document details the automated release process for GitHub Archiver CLI using semantic-release.
|
|
4
|
+
|
|
5
|
+
## How Releases Work
|
|
6
|
+
|
|
7
|
+
### 1. Commit Format
|
|
8
|
+
|
|
9
|
+
Use [Conventional Commits](https://www.conventionalcommits.org/):
|
|
10
|
+
|
|
11
|
+
- `feat:` - New features → **minor** version bump (1.0.0 → 1.1.0)
|
|
12
|
+
- `fix:` - Bug fixes → **patch** version bump (1.0.0 → 1.0.1)
|
|
13
|
+
- `BREAKING CHANGE:` - Breaking changes → **major** version bump (1.0.0 → 2.0.0)
|
|
14
|
+
- `chore:`, `docs:`, `test:` - No version bump
|
|
15
|
+
|
|
16
|
+
### 2. Automatic Trigger
|
|
17
|
+
|
|
18
|
+
Push to `main` branch triggers the release workflow:
|
|
19
|
+
|
|
20
|
+
1. Semantic release analyzes commits and determines version bump
|
|
21
|
+
2. Package version is updated, published to npm
|
|
22
|
+
3. GitHub release is created with changelog
|
|
23
|
+
4. Git tag is created automatically
|
|
24
|
+
|
|
25
|
+
### 3. Trusted Publishing
|
|
26
|
+
|
|
27
|
+
Uses OpenID Connect (OIDC) for secure, tokenless authentication:
|
|
28
|
+
|
|
29
|
+
- No npm tokens required - eliminates security risks
|
|
30
|
+
- Short-lived, cryptographically-signed tokens for each publish
|
|
31
|
+
- Works with personal GitHub accounts
|
|
32
|
+
|
|
33
|
+
### 4. Node Version Requirements
|
|
34
|
+
|
|
35
|
+
- Package runs on Node 18+ (see `package.json` engines)
|
|
36
|
+
- Release workflow uses Node 22+ (semantic-release requirement)
|
|
37
|
+
- CI tests on Node 18 and 22 for maximum compatibility
|
|
38
|
+
|
|
39
|
+
### 5. Example Workflow
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
git checkout main
|
|
43
|
+
git pull
|
|
44
|
+
# Make your commits with conventional format
|
|
45
|
+
git commit -m "feat: add support for custom config file"
|
|
46
|
+
git push
|
|
47
|
+
# Release happens automatically!
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Trusted Publishing Setup
|
|
51
|
+
|
|
52
|
+
This project uses npm's **Trusted Publishing** feature for secure, tokenless package publishing.
|
|
53
|
+
|
|
54
|
+
### Setup (one-time)
|
|
55
|
+
|
|
56
|
+
1. Go to https://www.npmjs.com/package/github-archiver/settings
|
|
57
|
+
2. Under **Trusted Publisher**, click **GitHub Actions**
|
|
58
|
+
3. Fill in:
|
|
59
|
+
- **Organization or user**: `mynameistito`
|
|
60
|
+
- **Repository**: `github-archiver`
|
|
61
|
+
- **Workflow filename**: `release.yml`
|
|
62
|
+
4. Click **Set up connection**
|
|
63
|
+
5. (Recommended) Enable **"Require two-factor authentication and disallow tokens"**
|
|
64
|
+
|
|
65
|
+
That's it! No tokens to manage, rotate, or worry about.
|
|
66
|
+
|
|
67
|
+
## Commit Message Examples
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
# Feature (minor version bump)
|
|
71
|
+
git commit -m "feat: add support for custom config file"
|
|
72
|
+
|
|
73
|
+
# Bug fix (patch version bump)
|
|
74
|
+
git commit -m "fix: handle empty repository list gracefully"
|
|
75
|
+
|
|
76
|
+
# Breaking change (major version bump)
|
|
77
|
+
git commit -m "feat!: change CLI command structure
|
|
78
|
+
|
|
79
|
+
BREAKING CHANGE: The 'auth' subcommand is now required"
|
|
80
|
+
|
|
81
|
+
# No release
|
|
82
|
+
git commit -m "chore: update dependencies"
|
|
83
|
+
git commit -m "docs: clarify installation steps"
|
|
84
|
+
git commit -m "test: add unit tests for parser"
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Manual Releases
|
|
88
|
+
|
|
89
|
+
If you need to publish without merging to main:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
npm run release -- --no-ci
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Release Workflow Details
|
|
96
|
+
|
|
97
|
+
The `.github/workflows/release.yml` file handles:
|
|
98
|
+
|
|
99
|
+
- Running tests on Node 18 and 22
|
|
100
|
+
- Building the project
|
|
101
|
+
- Publishing to npm using Trusted Publishing
|
|
102
|
+
- Creating GitHub releases with changelog
|
|
103
|
+
- Managing version tags automatically
|
|
104
|
+
|
|
105
|
+
## Troubleshooting
|
|
106
|
+
|
|
107
|
+
### Release Not Triggered
|
|
108
|
+
|
|
109
|
+
- Ensure commits follow conventional commit format
|
|
110
|
+
- Check that workflow file is named `release.yml`
|
|
111
|
+
- Verify GitHub Actions permissions are enabled
|
|
112
|
+
|
|
113
|
+
### Publish Failed
|
|
114
|
+
|
|
115
|
+
- Check npm Trusted Publisher configuration
|
|
116
|
+
- Ensure package name in package.json matches npm registry
|
|
117
|
+
- Verify semantic-release version range is valid
|
|
118
|
+
|
|
119
|
+
### Version Bump Incorrect
|
|
120
|
+
|
|
121
|
+
- Review commit history for proper prefixes
|
|
122
|
+
- Check that `BREAKING CHANGE:` is in commit body (footer)
|
|
123
|
+
- Ensure no duplicate release tags exist
|