semantic-release shareable configuration for Scratch
Find a file
2019-09-25 16:05:32 -05:00
.github/workflows fix: place tarball in a separate pack dir 2019-09-25 16:05:32 -05:00
.editorconfig feat: initial release 2019-06-11 14:01:53 -05:00
.gitignore feat: initial release 2019-06-11 14:01:53 -05:00
.releaserc.json fix: place tarball in a separate pack dir 2019-09-25 16:05:32 -05:00
CHANGELOG.md chore(release): 1.0.6 [skip ci] 2019-06-26 17:11:32 +00:00
LICENSE Initial commit 2019-06-11 13:05:37 -05:00
package-lock.json fix: place tarball in a separate pack dir 2019-09-25 16:05:32 -05:00
package.json fix: place tarball in a separate pack dir 2019-09-25 16:05:32 -05:00
README.md fix: place tarball in a separate pack dir 2019-09-25 16:05:32 -05:00

@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