Skip to content

Publish both to GPR and to NPM #52

Description

@vlilloh

I've correctly setup the Changesets Release Action to publish to GPR:

name: Release

on:
  push:
    branches:
      - master

jobs:
  release:
    name: Release
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@master
        with:
          fetch-depth: 0
      - name: Setup Node.js
        uses: actions/setup-node@master
        with:
          node-version: 14
          registry-url: https://npm.pkg.github.com
      - name: Install dependencies
        run: npm i
      - name: Build packages
        run: npm run build
      - name: Create Release Pull Request or Publish to GPR/NPM
        uses: changesets/action@master
        with:
          publish: npx changeset publish
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          # NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

But I can't setup the Changesets Release Action to publish the packages both to GPR and to NPM. Is it possible in the latest version?

Activity

  1. mark-omarov commented on Sep 27, 2020

    @mark-omarov
    Contributor

    I'm not sure it's possible what you're asking for, at least in a single step in a job. I think when you're publishing a package it checks the registry, that might be specified in .npmrc for example, but I guess it can be only a single registry per package. And I think it's not a good idea, in general, to publish to both registries anyway.

    Also, I noticed you use secrets.GITHUB_TOKEN, nothing wrong with that except you want changesets/action's generated PR to trigger other workflows. GITHUB_TOKEN does not trigger workflows, in case you'll encounter this problem - add your github personal access token to the secrets (eg. name GH_TOKEN) and refer to it for GITHUB_TOKEN like this:

    GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
    

    This is not what you've asked for, but might be helpful.

  2. zoubingwu commented on Jul 16, 2024

    @zoubingwu

    4 years later, I think it's very reasonable to publish to multiple registries simultaneously now due to the emergence of various runtimes and various registries like Deno, Bun, GitHub, and jsr.io?

    Does anyone using changeset/actions to publish to multiple registries?

  3. belfz commented on Oct 17, 2025

    @belfz

    Any progress on that? Is there a way to use e. g. npm.pkg.github.com as a registry?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions