fix(core): update

This commit is contained in:
Philipp Kunz 2024-05-24 15:54:32 +02:00
parent 6e4c967917
commit 9eaa6347c1
5 changed files with 157 additions and 71 deletions

View File

@ -14,15 +14,15 @@
"githost": "gitlab.com",
"gitscope": "ship.zone",
"gitrepo": "npmci",
"description": "A tool to enhance Node.js and Docker workflows within GitLab CI, providing various CI/CD utilities.",
"description": "A tool to streamline Node.js and Docker workflows within CI environments, particularly GitLab CI, providing various CI/CD utilities.",
"npmPackagename": "@ship.zone/npmci",
"license": "MIT",
"keywords": [
"Node.js",
"Docker",
"GitLab CI",
"continuous integration",
"continuous deployment",
"GitHub CI",
"Gitea CI",
"CI/CD",
"automation",
"npm",
@ -30,7 +30,9 @@
"cloud",
"SSH",
"registry",
"container management"
"container management",
"continuous integration",
"continuous deployment"
]
}
}

View File

@ -2,7 +2,7 @@
"name": "@ship.zone/npmci",
"version": "4.1.30",
"private": false,
"description": "A tool to enhance Node.js and Docker workflows within GitLab CI, providing various CI/CD utilities.",
"description": "A tool to streamline Node.js and Docker workflows within CI environments, particularly GitLab CI, providing various CI/CD utilities.",
"main": "dist_ts/index.js",
"typings": "dist_ts/index.d.ts",
"type": "module",
@ -78,8 +78,8 @@
"Node.js",
"Docker",
"GitLab CI",
"continuous integration",
"continuous deployment",
"GitHub CI",
"Gitea CI",
"CI/CD",
"automation",
"npm",
@ -87,6 +87,8 @@
"cloud",
"SSH",
"registry",
"container management"
"container management",
"continuous integration",
"continuous deployment"
]
}

View File

@ -0,0 +1,2 @@
- focus on cli usage in CI environments.
- show Gitlab CI, GitHub CI and Gitea CI examples.

200
readme.md
View File

@ -1,6 +1,5 @@
```markdown
# @ship.zone/npmci
node and docker in gitlab ci on steroids
A tool to enhance Node.js and Docker workflows within GitLab CI, providing various CI/CD utilities.
## Install
@ -18,7 +17,137 @@ yarn add @ship.zone/npmci
`npmci` is designed to streamline CI/CD processes, particularly in Docker and Node.js environments. The following sections illustrate its usage in various scenarios, from handling Node versions to building Docker images and more.
### 1. Handle Node Versions
### 1. Integration with GitLab CI, GitHub CI, and Gitea CI
#### GitLab CI
An example of integrating `npmci` into a GitLab CI configuration could look like this:
```yaml
image: hosttoday/ht-docker-node:npmci
stages:
- prepare
- build
- test
- deploy
default:
before_script:
- npmci node install stable
- npmci npm install
prepare:
stage: prepare
script:
- npmci prepare npm
- npmci prepare docker
build:
stage: build
script:
- npmci docker build
test:
stage: test
script:
- npmci npm test
deploy:
stage: deploy
script:
- npmci publish npm
- npmci docker push
environment:
name: production
url: http://example.com
```
#### GitHub Actions
Similarly, you can set up `npmci` in GitHub Actions:
```yaml
name: CI Pipeline
on:
push:
branches:
- main
jobs:
prepare:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '14'
- run: npm install -g @ship.zone/npmci
- run: npmci node install stable
- run: npmci npm install
build:
runs-on: ubuntu-latest
needs: prepare
steps:
- run: npmci docker build
test:
runs-on: ubuntu-latest
needs: build
steps:
- run: npmci npm test
deploy:
runs-on: ubuntu-latest
needs: test
steps:
- run: npmci publish npm
- run: npmci docker push
```
#### Gitea CI
Lastly, for Gitea CI:
```yaml
image: hosttoday/ht-docker-node:npmci
pipelines:
default:
- step:
name: Prepare
image: hosttoday/ht-docker-node:npmci
commands:
- npmci node install stable
- npmci npm install
- npmci prepare npm
- npmci prepare docker
- step:
name: Build
image: hosttoday/ht-docker-node:npmci
commands:
- npmci docker build
- step:
name: Test
image: hosttoday/ht-docker-node:npmci
commands:
- npmci npm test
- step:
name: Deploy
image: hosttoday/ht-docker-node:npmci
commands:
- npmci publish npm
- npmci docker push
```
### 2. Handle Node Versions
One of the core features of `npmci` is managing Node versions in your CI environment. You can specify which version of Node to install:
@ -49,7 +178,7 @@ async function manageNodeVersions() {
manageNodeVersions().then(() => console.log('Node versions managed successfully.'));
```
### 2. Handling npm and Yarn Tasks
### 3. Handling npm and Yarn Tasks
`npmci` provides numerous utilities to streamline npm and yarn workflow tasks within a CI/CD pipeline.
@ -68,7 +197,7 @@ async function manageNpmTasks() {
manageNpmTasks().then(() => console.log('Npm tasks handled successfully.'));
```
### 3. Docker Task Handling
### 4. Docker Task Handling
`npmci` simplifies Docker operations, particularly in building, testing, and publishing Docker images.
@ -132,7 +261,7 @@ async function pushDockerImages() {
pushDockerImages().then(() => console.log('Docker images pushed successfully.'));
```
### 4. Managing Docker Registries
### 5. Managing Docker Registries
`npmci` can handle multiple Docker registries and allows for easy integration within your CI pipeline.
@ -166,7 +295,7 @@ async function pullDockerImages() {
pullDockerImages().then(() => console.log('Docker images pulled successfully.'));
```
### 5. SSH Key Management
### 6. SSH Key Management
`npmci` also simplifies the management of SSH keys, which is crucial for accessing private repositories and servers.
@ -185,7 +314,7 @@ async function prepareSshKeys() {
prepareSshKeys().then(() => console.log('SSH keys prepared successfully.'));
```
### 6. Cloudron Integration
### 7. Cloudron Integration
For users deploying applications on Cloudron, `npmci` provides a set of utilities for automating Cloudron tasks.
@ -235,7 +364,7 @@ async function deployWithPreparedManifest() {
deployWithPreparedManifest().then(() => console.log('Deployment to Cloudron with manifest preparation completed.'));
```
### 7. Webhook Triggers
### 8. Webhook Triggers
`npmci` supports webhook triggers, allowing you to trigger builds and other activities based on various conditions.
@ -256,7 +385,7 @@ async function triggerWebhooks() {
triggerWebhooks().then(() => console.log('Webhooks triggered successfully.'));
```
### 8. Using the bash Helper
### 9. Using the bash Helper
`npmci` includes a bash helper for executing commands within a bash shell, useful for various custom tasks.
@ -273,55 +402,7 @@ async function runCustomBashCommand(command: string) {
runCustomBashCommand('echo Hello World').then(() => console.log('Custom command executed successfully.'));
```
### 9. Example CI Configuration
An example of integrating `npmci` into a GitLab CI configuration might look like this:
```yaml
image: hosttoday/ht-docker-node:npmci
stages:
- prepare
- build
- test
- deploy
default:
before_script:
- npmci node install stable
- npmci npm install
prepare:
stage: prepare
script:
- npmci prepare npm
- npmci prepare docker
build:
stage: build
script:
- npmci docker build
test:
stage: test
script:
- npmci npm test
deploy:
stage: deploy
script:
- npmci publish npm
- npmci docker push
- npmci cloudron deploy
environment:
name: production
url: http://example.com
```
This example YAML file configures stages for preparing the environment, building the project, running tests, and deploying the project. `npmci` commands are used throughout to handle various tasks.
## Full Features and Use Cases
### Full Features and Use Cases
Below is a comprehensive set of features and use cases supported by `npmci`. This section ensures you can take full advantage of the library's capabilities in multiple scenarios.
@ -410,5 +491,4 @@ handleDockerfileOperations().then(() => console.log('Dockerfile processing flow
```
This completes the comprehensive guide to `@ship.zone/npmci`. With the examples and explanations provided, you should be able to harness the full power and flexibility of the library to streamline your CI/CD processes effectively.
```
undefined

View File

@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@ship.zone/npmci',
version: '4.1.30',
description: 'A tool to enhance Node.js and Docker workflows within GitLab CI, providing various CI/CD utilities.'
version: '4.1.31',
description: 'A tool to streamline Node.js and Docker workflows within CI environments, particularly GitLab CI, providing various CI/CD utilities.'
}