1.0.0 • Published 5 years ago

from-changelog-to-npm v1.0.0

Weekly downloads
-
License
GPL-3.0
Repository
gitlab
Last release
5 years ago

 

From Changelog to NPM

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

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

 

Update Unreleased section in CHANGELOG.md

 

New Release in CHANGELOG.md

 

Changes

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

 

Installation & Usage

:key: Create NPM Token to grant publish access:

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


:key: Create Gitlab token to grand git access:

Fill the form with these values:

FieldValue
NameGITLAB_CI_TOKEN
Scopes > api:ballot_box_with_check:

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


:abc: Add tokens in Environment variables:

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

Click Add variable

FieldValue
KeyNPM_PUBLISH_TOKEN
Value:key: paste your NPM token here
Mask variable:ballot_box_with_check: (mask token in log)

Click Add variable

FieldValue
KeyGITLAB_CI_TOKEN
Value:key: paste your gitlab token here
Mask variable:ballot_box_with_check: (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.

:information_source: Pro tips: no need to add date for your release... it's automatic too ! :wink: - 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

 

1.0.0

5 years ago

1.0.0-beta.2

5 years ago

1.0.0-beta.1

5 years ago