from-changelog-to-npm

1.0.0 • Public • Published

From Changelog to NPM

Write your Changelog and let the watcher create the Release and NPM package automatically!


 

From Changelog to NPM

Create tokens in your account, include the watcher in your .gitlab-ci.yml and 🚀.

Just follow the Keep a Changelog format, and add a new release in your CHANGELOG.md. The watcher will update the version in your package(-lock).json, create a tag, a release and publish your package to NPM.

Default pipeline

Default pipeline

 

Update [Unreleased] section in CHANGELOG.md

Canceled pipeline

 

New Release in CHANGELOG.md

Release pipeline

 

Changes

All details of changes to this project will be documented in this file.

 

Installation & Usage

🔑 Create NPM Token to grant publish access:

Click Create Token, select Read and Publish then click Create Token ( 📝 keep the token for the last part).


🔑 Create Gitlab token to grand git access:

Fill the form with these values:

Field Value
Name GITLAB_CI_TOKEN
Scopes > api ☑️

then click Create personal access token ( 📝 keep the token for the last part).


🔤 Add tokens in Environment variables:

Go to your Project > Settings > Continuous Integration/Continuous Delivery, and expand Variables block.

Click Add variable

Field Value
Key NPM_PUBLISH_TOKEN
Value 🔑 [paste your NPM token here]
Mask variable ☑️ (mask token in log)

Click Add variable

Field Value
Key GITLAB_CI_TOKEN
Value 🔑 [paste your gitlab token here]
Mask variable ☑️ (mask token in log)

Great, your Environment is ready!

The watcher can now access tokens to create Release and publish to NPM for you.

Include the watcher in your .gitlab-ci.yml and add the Release stage where you want (after your tests, for example):

.gitlab-ci.yml

include: 'https://gitlab.com/guillew/from-changelog-to-npm/raw/v1.0.0/watch.yml'

stages:
  - Release

That's All Folks!

Now edit your CHANGELOG.md and add a new Release following the Keep a Changelog format.

ℹ️ Pro tips: no need to add date for your release... it's automatic too ! 😉 - YYYY-MM-DD will be added if not set.

## [1.0.0]
### Added
- "From Changelog to NPM" watcher

 

Example

.gitlab-ci.yml

include: 'https://gitlab.com/guillew/from-changelog-to-npm/raw/v1.0.0/watch.yml'

stages:
  - test
  - coverage
  - Release

Test job:
  image: alpine
  script:
    - echo "Hello"

Coverage job:
  stage: coverage
  image: alpine
  script:
    - echo "world !"

CHANGELOG.md

# Changelog
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
- You MUST keep the [Unreleased] section to make it work!

## [1.0.0] - 2020-08-16
### Added
- I now use "From Changelog to NPM" pipeline!

 

Contribution

Any help or feedback are really welcome, no matter how great or small!

Please make sure to read the Contributing Guide before making a pull request.

 

License

GPL-3.0

 

Package Sidebar

Install

npm i from-changelog-to-npm

Weekly Downloads

1

Version

1.0.0

License

GPL-3.0

Unpacked Size

184 kB

Total Files

15

Last publish

Collaborators

  • guillew