@github-actions-workflow-ts/lib 2.0.0-beta.0 → 2.0.0-beta.1
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 +81 -0
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# @github-actions-workflow-ts/lib
|
|
2
|
+
|
|
3
|
+
Type-safe GitHub Actions workflow builder library for TypeScript.
|
|
4
|
+
|
|
5
|
+
Stop writing workflows in YAML and use TypeScript instead!
|
|
6
|
+
|
|
7
|
+
<p align="center"><img src="https://github.com/emmanuelnk/github-actions-workflow-ts/assets/19330930/9121bb33-cd51-41f3-830f-9b4bd1117320" alt="github-actions-workflow-ts-logo" width="400"/></p>
|
|
8
|
+
|
|
9
|
+
<p align="center">
|
|
10
|
+
<a href="https://github.com/emmanuelnk/github-actions-workflow-ts">
|
|
11
|
+
<img src="https://raw.githubusercontent.com/ellerbrock/open-source-badges/master/badges/open-source-v1/open-source.png" alt="love opensource">
|
|
12
|
+
</a>
|
|
13
|
+
<a href="https://github.com/emmanuelnk/github-actions-workflow-ts/blob/master/LICENSE">
|
|
14
|
+
<img src="https://img.shields.io/badge/license-MIT-green.svg" alt="license">
|
|
15
|
+
</a>
|
|
16
|
+
<a href="https://www.npmjs.com/package/@github-actions-workflow-ts/lib">
|
|
17
|
+
<img src="https://img.shields.io/npm/v/@github-actions-workflow-ts/lib.svg" alt="npm version">
|
|
18
|
+
</a>
|
|
19
|
+
</p>
|
|
20
|
+
|
|
21
|
+
## Installation
|
|
22
|
+
|
|
23
|
+
### Full Installation (recommended)
|
|
24
|
+
|
|
25
|
+
Install both the library and CLI to write workflows in TypeScript and generate YAML files:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npm install --save-dev @github-actions-workflow-ts/lib @github-actions-workflow-ts/cli
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Library Only
|
|
32
|
+
|
|
33
|
+
If you only want to generate workflow JSON objects and handle YAML file generation yourself, install just the zero-dependency library:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
npm install --save-dev @github-actions-workflow-ts/lib
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
The library package has **zero dependencies** and works in both ESM and CommonJS projects.
|
|
40
|
+
|
|
41
|
+
## Quick Start
|
|
42
|
+
|
|
43
|
+
```ts
|
|
44
|
+
import { Workflow, NormalJob, Step } from '@github-actions-workflow-ts/lib'
|
|
45
|
+
|
|
46
|
+
const checkoutStep = new Step({
|
|
47
|
+
name: 'Checkout',
|
|
48
|
+
uses: 'actions/checkout@v3',
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
const testJob = new NormalJob('Test', {
|
|
52
|
+
'runs-on': 'ubuntu-latest',
|
|
53
|
+
'timeout-minutes': 2
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
export const exampleWorkflow = new Workflow('example-filename', {
|
|
57
|
+
name: 'Example',
|
|
58
|
+
on: {
|
|
59
|
+
workflow_dispatch: {}
|
|
60
|
+
}
|
|
61
|
+
})
|
|
62
|
+
|
|
63
|
+
testJob.addStep(checkoutStep)
|
|
64
|
+
exampleWorkflow.addJob(testJob)
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Documentation
|
|
68
|
+
|
|
69
|
+
For full documentation, examples, and API reference, visit the [main repository](https://github.com/emmanuelnk/github-actions-workflow-ts).
|
|
70
|
+
|
|
71
|
+
## Features
|
|
72
|
+
|
|
73
|
+
- **Type Safety**: Full TypeScript support with types generated from the official GitHub Actions Workflow JSON Schema
|
|
74
|
+
- **Zero Dependencies**: The library has no external dependencies
|
|
75
|
+
- **Dual Module Support**: Works with both ESM and CommonJS projects
|
|
76
|
+
- **Intuitive API**: Builder pattern for constructing workflows, jobs, and steps
|
|
77
|
+
- **Expression Helpers**: Utilities for GitHub Actions expressions like `${{ secrets.TOKEN }}`
|
|
78
|
+
|
|
79
|
+
## License
|
|
80
|
+
|
|
81
|
+
MIT
|