Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add changeset tag to custom publishing section of README #271

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ If you want to hook into when publishing should occur but have your own publishi

Note that you might need to account for things already being published in your script because a commit without any new changesets can always land on your base branch after a successful publish. In such a case you need to figure out on your own how to skip over the actual publishing logic or handle errors gracefully as most package registries won't allow you to publish over already published version.

If you need GitHub releases and Git tags, make sure to include `changeset tag` in the action publish script.

```yml
name: Release

Expand Down Expand Up @@ -155,6 +157,9 @@ jobs:
- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@v1
with:
# Include this to create GitHub releases and Git tags
# publish: yarn changeset tag
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tbf - I think I have successfully used Changesets with custom release scripts like this:

      - name: Create Release Pull Request or Publish to npm
        id: changesets
        uses: changesets/action@v1
        with:
          publish: yarn run release

where the release script be defined like this:

    "release": "node ./scripts/release.js && yarn changeset tag"

This way you don't have to rely on steps.changesets.outputs.hasChangeset at all

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand Down