[](https://constructs.dev/packages/github-actions-cdk)
# 🚧 GitHub Actions CDK
**github-actions-cdk** is a TypeScript library that simplifies the creation and management of GitHub Actions workflows using Constructs. With this library, developers can define workflows in a structured and type-safe manner, making it easier to automate CI/CD pipelines on GitHub. It also includes Python bindings for developers who prefer working in Python.
## Features
* **Type-Safe Workflows**: Leverage TypeScript's strong typing to define your GitHub Actions workflows and ensure correctness.
* **Python Bindings**: Access the same powerful constructs and features in Python, allowing seamless integration for Python developers.
* **Modular Design**: Easily create and manage jobs, triggers, and options for your workflows.
## Installation
To get started with `github-actions-cdk`, install the package using npm or yarn for TypeScript, or pip for Python:
### TypeScript
```bash
npm install github-actions-cdk
```
or
```bash
yarn add github-actions-cdk
```
### Python
```bash
pip install github-actions-cdk
```
## Getting Started
### Basic Usage (TypeScript)
Here's a simple example of how to create a GitHub Actions workflow using `github-actions-cdk` in TypeScript::
```python
import { PermissionLevel, Project, actions } from 'github-actions-cdk';
const project = new Project({
//additionalChecks: true,
});
const workflow = project.addWorkflow("build", {
name: "Build",
triggers: {
push: { branches: ["main"] },
workflowDispatch: {},
},
permissions: {
contents: PermissionLevel.READ,
},
});
const job = workflow.addJob("build", {
env: {
CI: "true",
},
});
new actions.CheckoutV4(job, "checkout", {
name: "Checkout Code",
});
const setupNode = new actions.SetupNodeV4(job, "setup-node", {
name: "Set up Node.js",
nodeVersion: "20.x",
});
job.addOutput("node-version", setupNode.outputs.nodeVersion);
project.synth();
```
### Basic Usage (Python)
Here's how to create a GitHub Actions workflow using `github-actions-cdk` in Python:
```python
from github_actions_cdk import Project, PermissionLevel
from github_actions_cdk.actions import CheckoutV4, SetupNodeV4
project = Project(
#additional_checks=True,
)
workflow = project.add_workflow(
id="build",
name="Build",
triggers={
"push": {
"branches": ["main"],
}
},
permissions={
"contents": PermissionLevel.READ,
}
)
job = workflow.add_job(
id="build",
env={
"CI": "true",
},
)
CheckoutV4(
scope=job,
id="checkout",
name="Checkout Code",
)
setup_node = SetupNodeV4(
scope=job,
id="setup-node",
name="Set up Node.js",
node_version="14.x",
)
job.add_output("node-version", setup_node.outputs.node_version)
project.synth()
```
## Contributing
Contributions are welcome! Please read the [CONTRIBUTING.md](../../CONTRIBUTING.md) for details on how to get involved.
## License
This project is licensed under the MIT License. See the [LICENSE](../../LICENCE) file for more information.
Raw data
{
"_id": null,
"home_page": "https://github.com/hupe1980/github-actions-cdk.git",
"name": "github-actions-cdk",
"maintainer": null,
"docs_url": null,
"requires_python": "~=3.8",
"maintainer_email": null,
"keywords": null,
"author": "hupe1980",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/3f/72/35dd9fa3e34c833b600a578865a760be9013cfe140e87a8473524602218e/github_actions_cdk-0.0.23.tar.gz",
"platform": null,
"description": "[](https://constructs.dev/packages/github-actions-cdk)\n\n# \ud83d\udea7 GitHub Actions CDK\n\n**github-actions-cdk** is a TypeScript library that simplifies the creation and management of GitHub Actions workflows using Constructs. With this library, developers can define workflows in a structured and type-safe manner, making it easier to automate CI/CD pipelines on GitHub. It also includes Python bindings for developers who prefer working in Python.\n\n## Features\n\n* **Type-Safe Workflows**: Leverage TypeScript's strong typing to define your GitHub Actions workflows and ensure correctness.\n* **Python Bindings**: Access the same powerful constructs and features in Python, allowing seamless integration for Python developers.\n* **Modular Design**: Easily create and manage jobs, triggers, and options for your workflows.\n\n## Installation\n\nTo get started with `github-actions-cdk`, install the package using npm or yarn for TypeScript, or pip for Python:\n\n### TypeScript\n\n```bash\nnpm install github-actions-cdk\n```\n\nor\n\n```bash\nyarn add github-actions-cdk\n```\n\n### Python\n\n```bash\npip install github-actions-cdk\n```\n\n## Getting Started\n\n### Basic Usage (TypeScript)\n\nHere's a simple example of how to create a GitHub Actions workflow using `github-actions-cdk` in TypeScript::\n\n```python\nimport { PermissionLevel, Project, actions } from 'github-actions-cdk';\n\nconst project = new Project({\n //additionalChecks: true,\n});\n\nconst workflow = project.addWorkflow(\"build\", {\n name: \"Build\",\n triggers: {\n push: { branches: [\"main\"] },\n workflowDispatch: {},\n },\n permissions: {\n contents: PermissionLevel.READ,\n },\n});\n\nconst job = workflow.addJob(\"build\", {\n env: {\n CI: \"true\",\n },\n});\n\nnew actions.CheckoutV4(job, \"checkout\", {\n name: \"Checkout Code\",\n});\n\nconst setupNode = new actions.SetupNodeV4(job, \"setup-node\", {\n name: \"Set up Node.js\",\n nodeVersion: \"20.x\",\n});\n\njob.addOutput(\"node-version\", setupNode.outputs.nodeVersion);\n\nproject.synth();\n```\n\n### Basic Usage (Python)\n\nHere's how to create a GitHub Actions workflow using `github-actions-cdk` in Python:\n\n```python\nfrom github_actions_cdk import Project, PermissionLevel\nfrom github_actions_cdk.actions import CheckoutV4, SetupNodeV4\n\nproject = Project(\n #additional_checks=True,\n)\n\nworkflow = project.add_workflow(\n id=\"build\",\n name=\"Build\",\n triggers={\n \"push\": {\n \"branches\": [\"main\"],\n }\n },\n permissions={\n \"contents\": PermissionLevel.READ,\n }\n)\n\njob = workflow.add_job(\n id=\"build\",\n env={\n \"CI\": \"true\",\n },\n)\n\nCheckoutV4(\n scope=job,\n id=\"checkout\",\n name=\"Checkout Code\",\n)\n\nsetup_node = SetupNodeV4(\n scope=job,\n id=\"setup-node\",\n name=\"Set up Node.js\",\n node_version=\"14.x\",\n)\n\njob.add_output(\"node-version\", setup_node.outputs.node_version)\n\nproject.synth()\n```\n\n## Contributing\n\nContributions are welcome! Please read the [CONTRIBUTING.md](../../CONTRIBUTING.md) for details on how to get involved.\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](../../LICENCE) file for more information.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A TypeScript library for creating and managing GitHub Actions workflows using Constructs, enabling type-safe and modular CI/CD automation.",
"version": "0.0.23",
"project_urls": {
"Homepage": "https://github.com/hupe1980/github-actions-cdk.git",
"Source": "https://github.com/hupe1980/github-actions-cdk.git"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "8d7a4d87f20da4ea27ee7a4f5217285177f89d3b4cb40c98ce40f65610e26f75",
"md5": "3b3996f2745c0aac9dd524b5c40ab8d1",
"sha256": "daeb314cdc32b86ac8a9f89146b1b6c5862b9a7e02e5ade6155c72d1de1448e6"
},
"downloads": -1,
"filename": "github_actions_cdk-0.0.23-py3-none-any.whl",
"has_sig": false,
"md5_digest": "3b3996f2745c0aac9dd524b5c40ab8d1",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "~=3.8",
"size": 258995,
"upload_time": "2024-11-05T21:01:25",
"upload_time_iso_8601": "2024-11-05T21:01:25.013587Z",
"url": "https://files.pythonhosted.org/packages/8d/7a/4d87f20da4ea27ee7a4f5217285177f89d3b4cb40c98ce40f65610e26f75/github_actions_cdk-0.0.23-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "3f7235dd9fa3e34c833b600a578865a760be9013cfe140e87a8473524602218e",
"md5": "4e98a7a86d36559149f9d7c49f803c7c",
"sha256": "10fed0cdead0c5efcd732e2427508facfe7a032c4d865ad25a0bfe87fd93f3e3"
},
"downloads": -1,
"filename": "github_actions_cdk-0.0.23.tar.gz",
"has_sig": false,
"md5_digest": "4e98a7a86d36559149f9d7c49f803c7c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "~=3.8",
"size": 260526,
"upload_time": "2024-11-05T21:01:32",
"upload_time_iso_8601": "2024-11-05T21:01:32.967008Z",
"url": "https://files.pythonhosted.org/packages/3f/72/35dd9fa3e34c833b600a578865a760be9013cfe140e87a8473524602218e/github_actions_cdk-0.0.23.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-05 21:01:32",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "hupe1980",
"github_project": "github-actions-cdk",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "github-actions-cdk"
}