Skip to content

publishedPackages doesn't contain packages if not published to npm #532

@mikeybinns

Description

@mikeybinns

Changesets can be used to version non-npm packages as noted by the documentation here:
https://github.com/changesets/changesets/blob/main/docs/versioning-apps.md

When running the action, the action successfully creates tags for my non-npm packages, however when looking at the outputs.publishedPackages part, it doesn't include the packages where the version has been bumped. What this means is I can't have a second step which relies on the release to perform a second action (e.g. publish to a non-npm source like packagist).

There doesn't seem to be anything in the docs which suggests that these are missing on purpose, so I think it's a bug. If it's not a bug and this is indeed the intended outcome, then the docs of the versioning apps section should be updated to note this behaviour. I can confirm published outputs "true" as expected, but publishedPackages just outputs an empty string.

Here's a limited example to showcase what my workflow looks like.

jobs:
  release:
    name: Release
    runs-on: ubuntu-latest
    outputs:
      published: ${{ steps.changesets.outputs.published }}
      publishedPackages: ${{ steps.changesets.outputs.publishedPackages }}
    steps:
      - name: Create release pull request or create tag for other jobs
        id: changesets
        uses: changesets/action@v1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          publish: changeset tag
  second-job:
    name: Do thing based on changesets publish only if particular package is released
    needs: release
    if: ${{ needs.release.outputs.published == 'true' && contains(needs.release.outputs.publishedPackages.*.name, '@company/package') }}
  third-job:
    name: Do different thing based on changesets publish only if a different package is released
    needs: release
    if: ${{ needs.release.outputs.published == 'true' && contains(needs.release.outputs.publishedPackages.*.name, '@company/package_2') }}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions