Skip to content

Commit 6c2fb5a

Browse files
authored
Merge pull request codefresh-io#5 from ziv-codefresh/Release-to-NPM
release to npm
2 parents 290de1e + dbdf63c commit 6c2fb5a

File tree

3 files changed

+75
-0
lines changed

3 files changed

+75
-0
lines changed

stable/relese-to-NPM/NOTES.md

Whitespace-only changes.

stable/relese-to-NPM/README.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Codefresh release-to-npm Plugin
2+
3+
The release-to-npm can be used to publish images to npm.
4+
5+
## Usage
6+
7+
Set required and optional environment variable and add the following step to your Codefresh pipeline:
8+
9+
```yaml
10+
---
11+
version: '1.0'
12+
13+
steps:
14+
15+
...
16+
17+
deploy_to_npm:
18+
title: Publishing To Npm
19+
image: codefresh/release-to-npm
20+
commands:
21+
- NPM_TOKEN=${{NPM_TOKEN}} npm run release-to-npm
22+
...
23+
24+
```
25+
26+
## Environment Variables
27+
28+
- **required** `NPM_TOKEN` - token of npm account
29+
30+
## How to use
31+
32+
- Add as a dependency to your project `npm install --save-dev release-to-npm`
33+
34+
- Login into your project's NPM registry
35+
36+
```
37+
npm login --registry <registry url>
38+
npm login --registry http://registry.npmjs.org
39+
```
40+
41+
- Copy the token
42+
43+
see how to extracting the NPM_TOKEN https://docs.npmjs.com/private-modules/ci-server-config#getting-an-authentication-token
44+
45+
- Set the token as environment variable
46+
47+
- Add script command
48+
49+
Create a script command to run the release-to-npm, in your `package.json`
50+
51+
```json
52+
{
53+
"scripts": {
54+
"release-to-npm": "release-to-npm"
55+
}
56+
}
57+
```
58+
59+
60+
61+

stable/relese-to-NPM/plugin.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
version: '1.0'
2+
steps:
3+
BuildingDockerImage:
4+
title: Building Docker Image
5+
type: build
6+
image_name: zivcodefresh/npmtest
7+
working_directory: ./
8+
dockerfile: Dockerfile
9+
tag: '${{CF_BRANCH_TAG_NORMALIZED}}'
10+
deploy_to_npm:
11+
title: Publishing To Npm
12+
image: codefresh/release-to-npm
13+
commands:
14+
- NPM_TOKEN=${{NPM_TOKEN}} npm run release-to-npm

0 commit comments

Comments
 (0)