Publish package

Action designed to automate the process of publishing a Lerna package to a github npm registry

exile.watch logo

This page covers publish-package* actions

Usage

  1. Update package.json with following script:

// {root}/package.json
{
  "release": "voidstone"
}
  1. Update publish-package.yaml workflow:

# {root}/.github/workflows/publish-package.yaml
name: "Publish package: @exile-watch / doryani"

on:
  push:
    paths:
      - 'packages/**'
      - '!packages/**/*.md'
    branches:
      - main

concurrency: ${{ github.workflow }}-${{ github.ref }}

permissions:
  contents: write
  pull-requests: write
  issues: write
  packages: write

jobs:
  code-quality-assurance:
    if: "!contains(github.event.head_commit.message, '[skip ci]')"
    runs-on: ubuntu-latest
    name: Code quality assurance
    steps:
      - uses: exile-watch/doryani/code-quality-assurance@main
        with:
          GH_TOKEN: ${{ secrets.GH_TOKEN }}

  publish-package:
    needs: [code-quality-assurance]
    name: Publish to NPM
    runs-on: ubuntu-latest
    steps:
      - name: Authenticate to GitHub Registry
        uses: exile-watch/doryani/auth-github-registry@main
        with:
          GH_TOKEN: ${{ secrets.GH_TOKEN }}

      - name: Install deps
        uses: exile-watch/doryani/install-npm-dependencies@main
        with:
          GH_TOKEN: ${{ secrets.GH_TOKEN }}

      - run: npm run release
        env:
          GH_TOKEN: ${{ secrets.GH_TOKEN }}
          NODE_AUTH_TOKEN: ${{ secrets.GH_TOKEN }}
          GITHUB_REPOSITORY: ${{ github.repository }}

Last updated

Was this helpful?