包详细信息

@jedmao/semantic-release-npm-github-config

jedmao1.7kMIT1.0.9

semantic-release shareable configuration for npm + GitHub

semantic-release, semantic-release-config, npm, github

自述文件

@jedmao/semantic-release-npm-github-config

semantic-release shareable config to publish npm packages with GitHub.

GitHub Actions npm version

Plugins

This shareable configuration uses the following plugins:

Summary

  • Provides an informative git commit message for the release commit that does not trigger continuous integration and conforms to the conventional commits specification (e.g., "chore(release): 1.2.3 [skip ci]\n\nnotes").
  • Creates a tarball that gets uploaded with each GitHub release.
  • Publishes the same tarball to npm.
  • Commits the version change in package.json.
  • Creates or updates a changelog file.

Install

$ npm install --save-dev semantic-release @jedmao/semantic-release-npm-github-config

Usage

The shareable config can be configured in the semantic-release configuration file:

{
  "extends": "@jedmao/semantic-release-npm-github-config",
  "branch": "master"
}

Configuration

Ensure that your CI configuration has the following secret environment variables set:

See each plugin documentation for required installation and configuration steps.

GitHub workflows

If you're configuring a GitHub workflow you might want to do a test build matrix first and then publish only if those tests succeed across all environments. The following will do just that, immediately after something is merged into master.

name: Node CI

on:
  push:
    branches:
      - master

jobs:
  test:
    name: Test on node ${{ matrix.node }} and ${{ matrix.os }}

    runs-on: ${{ matrix.os }}

    strategy:
      matrix:
        node: [8, 10, 12]
        os:
          - ubuntu-latest
          - windows-latest
          - macOS-latest

    steps:
      - name: Preserve line endings
        run: git config --global core.autocrlf false
      - name: Checkout
        uses: actions/checkout@v1
      - name: Setup Node
        uses: actions/setup-node@v1
        with:
          node-version: ${{ matrix.node }}
      - name: Install & test/cover
        run: npm ci && npm run cover
        env:
          CI: true

  release:
    name: npm publish / GitHub release
    needs: test
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v1
      - name: Setup Node
        uses: actions/setup-node@v1
        with:
          node-version: 12
          registry-url: https://registry.npmjs.org/
      - name: Install
        env:
          CI: true
        run: npm ci
      - name: Build
        if: success()
        run: npm run build
      - name: Semantic Release
        if: success()
        env:
          GH_TOKEN: ${{ secrets.GH_TOKEN }}
          NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
          NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
        run: npx semantic-release

更新日志

Changelog

All notable changes to this project will be documented in this file. See Conventional Commits for commit guidelines.

1.0.9 (2019-12-02)

Bug Fixes

  • update dependencies, audit fix (4f07b55)

1.0.8 (2019-11-03)

Bug Fixes

  • update dependencies (security fixes) (acaeeb6)

1.0.7 (2019-09-25)

Bug Fixes

  • place tarball in a separate pack dir (8d609a7)

1.0.6 (2019-06-26)

Bug Fixes

1.0.5 (2019-06-26)

Bug Fixes

1.0.4 (2019-06-11)

Bug Fixes

  • release notes after changelog title (2dd093c)

1.0.3 (2019-06-11)

Bug Fixes

1.0.2 (2019-06-11)

Bug Fixes

  • add # before Changelog title (9c6dd04)

1.0.1 (2019-06-11)

Bug Fixes

1.0.0 (2019-06-11)

Bug Fixes

Features