0.8.5 • Published 8 months ago

@isbl/publisher v0.8.5

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

@isbl/publisher

MIT License npm dependencies npm.io Releases

Automates release process. Creates github releases from commit messages and attaches correct labels. Works both with self-hosted gitlab instances and github.com.

You can see it in action on release of this package. It currently assumes that you use yarn classic, but it shouldn't be difficult to adjust for other package managers too.

Why?

Automate creating changelogs from commit messages. Also creates git tags and publishes to NPM. All automated in CI. Works both on GitHub and GitLab (.com or self-hosted). See below for setup.

How to setup

Run following two commands. It'll ask you a few questions and perform neccessary changes. Then commit the result and push it.

yarn add -D @isbl/publisher
yarn isbl-publisher setup

Manual setup (GitHub)

(see below for automated version using GitHub actions)

Install from npm

yarn add -D @isbl/publisher

add to your scripts in package.json

{
  "repository": {
    "type": "git",
    "url": "https://github.com/please-replace/with-correct-repo.git"
  },
  "scripts": {
    "prepare": "yarn build",
    "prepublishOnly": "isbl-publisher prepublishOnly"
  }
}

GitHub action

Setup for github (above) and add following to .github/workflows/release.yml file:

name: release
on:
  push:
    branches:
      - main
jobs:
  release:
    name: release
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
        with:
          fetch-depth: 0
      - uses: actions/setup-node@v2
        with:
          node-version: 14
          cache: yarn
          registry-url: 'https://registry.npmjs.org'
      - run: yarn
      - run: yarn isbl-publisher publish
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

Run npm token create to create your npm token. Create repository secret in Settings > Secrets named NPM_TOKEN with contents of your secret.

Manual setup (GitLab)

Install from npm

yarn add -D @isbl/publisher

add to your scripts in package.json

{
  "repository": {
    "type": "git",
    "url": "https://gitlab.example.com/group/repo.git"
  },
  "scripts": {
    "prepare": "yarn build",
    "prepublishOnly": "isbl-publisher prepublishOnly"
  }
}

the prepublishOnly script prevents accidental publishes.

Publishing

Increment version in your package.json and push to the main branch.

Arguments

  • --dry-run prevents publisher from executing any state-changing commands. Useful for debugging and for verification of initial setup.
  • --verbose prints extra information while running. Does not print secrets, so it's safe to use this in CI. But it makes the output harder to read.
  • --ci simulates running on CI. This is also enabled by CI env variable which is set by both gitlab ci and github actions.
  • --no-draft github CI mode creates release draft by default to allow you to manually edit release notes before GitHub sends out emails. This option changes that behaviour.

Environment variables

  • CI enables CI mode. GitHub actions and GitLab runner set this by default.
  • CORRECT_PUBLISH publisher sets this and prepublish-only checks for it's presence. This is to prevent people from running yarn publish directly.
  • npm_package_repository_url this is set by npm/yarn when running scripts.
  • CI_PROJECT_ID used in gitlab CI publish. Set by GitLab runner by default. Used for finding correct gitlab project when accessing the API.
  • CI_JOB_TOKEN used in gitlab CI publish. Set by GitLab runner by default. Used for accessing the gitlab API.
  • GITHUB_TOKEN used in github CI publish. Must be set in workflow file.
0.8.5

8 months ago

0.8.4

8 months ago

0.8.3

8 months ago

0.8.1

3 years ago

0.8.2

3 years ago

0.8.0-alpha.1

3 years ago

0.8.0-alpha.0

3 years ago

0.8.0

3 years ago

0.7.1

3 years ago

0.5.0-alpha.3

3 years ago

0.5.0-alpha.2

3 years ago

0.5.0-alpha.1

3 years ago

0.5.0

3 years ago

0.7.0

3 years ago

0.6.1

3 years ago

0.6.0

3 years ago

0.4.2

3 years ago

0.4.1

3 years ago

0.4.0

3 years ago

0.3.0-alpha.6

3 years ago

0.3.0-alpha.7

3 years ago

0.3.0-alpha.8

3 years ago

0.3.0

3 years ago

0.3.0-alpha.2

3 years ago

0.3.0-alpha.3

3 years ago

0.3.0-alpha.4

3 years ago

0.3.0-alpha.5

3 years ago

0.3.1

3 years ago

0.3.0-alpha.0

3 years ago

0.3.0-alpha.1

3 years ago

0.2.0

3 years ago

0.1.7

3 years ago

0.1.6

3 years ago

0.1.5

3 years ago

0.1.4

3 years ago