Skip to content

feat: switch to changesets release PR workflow - #951

Open
kdaviduik wants to merge 1 commit into
mainfrom
03-13-chore_delete_deploying.md
Open

feat: switch to changesets release PR workflow#951
kdaviduik wants to merge 1 commit into
mainfrom
03-13-chore_delete_deploying.md

Conversation

@kdaviduik

@kdaviduik kdaviduik commented Mar 14, 2026

Copy link
Copy Markdown
Contributor

Part of https://github.com/Shopify/developer-tools-team/issues/1195


Summary

  • Delete DEPLOYING.md (info is now in CONTRIBUTING.md instead))
    • Almost all of the previous information in DEPLOYING.md was no longer accurate now that there's a changeset release PR rather than a release happening upon merging into main
  • Create CLAUDE.md and AGENTS.md as symlinks to CONTRIBUTING.md so that we have a single source of truth for all of this information and agents automatically "see" it
  • Rewrite npm-release.yml for the changesets release PR pattern: pending changesets create a [ci] release PR; merging that PR triggers npm publish

Why

The previous workflow published to npm immediately on PR merge. This made it extremely un-ergonomic to batch multiple merchant-facing changes in a single release, and required workarounds (like adding [DOCS] to the PR title) to avoid releasing a new Buy Button JS version when there were zero code changes. The release PR pattern (used by Hydrogen and many Shopify repos) creates an intermediate PR showing exactly what will be published and is the more modern, preferred way of managing releases.

External prerequisite

SHOPIFY_GH_ACCESS_TOKEN has been provisioned via github-actions-access-provider#2613

Comment thread CONTRIBUTING.md

If your PR doesn't need a new npm release (docs-only changes, test updates, CI changes, etc.), just don't include a changeset. No changeset = no release PR = no npm publish.

### Rollback (update `latest` CDN version)

@kdaviduik kdaviduik Mar 18, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It's extremely rare that we'd need/want to do this, but this was in the old DEPLOYING.md and is helpful to have just in case, especially the info like how to purge the CDN cache

@@ -1,29 +1,31 @@
name: Release new NPM version
name: Release

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Overall this is very similar to Hydrogen's release.yml workflow

@kdaviduik
kdaviduik force-pushed the 03-13-chore_delete_deploying.md branch from 215a2cc to 5ebe7c7 Compare March 18, 2026 19:01
Base automatically changed from enable-auto-changelog to main August 6, 2026 21:17
Comment thread .changeset/config.json
"fixed": [],
"linked": [],
"access": "restricted",
"access": "public",

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Must be public since this is a public package on npm, docs

@kdaviduik
kdaviduik force-pushed the 03-13-chore_delete_deploying.md branch from 5ebe7c7 to e8de275 Compare August 22, 2026 00:08
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 1
fetch-depth: 0

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Why fetch-depth: 0 instead of the default 1?

fetch-depth: 1 (the checkout action's default) does a shallow clone — only the latest commit, no history, no tags. fetch-depth: 0 fetches the entire git history including all branches and tags.

This is required here because the changesets/action step (changeset version + changeset publish) depends on:

  1. Git tags — Changesets uses tags to determine which version to publish and to create GitHub releases. A shallow clone doesn't fetch them.
  2. Full commit history — When generating the release PR, Changesets inspects commits since the last release to build changelog entries and determine which packages changed.

With the default fetch-depth: 1, you'd hit errors like "could not find tag" and end up with empty/incomplete changelogs.

@kdaviduik
kdaviduik marked this pull request as ready for review August 22, 2026 00:11
@kdaviduik
kdaviduik requested a review from a team as a code owner August 22, 2026 00:11
@kdaviduik
kdaviduik force-pushed the 03-13-chore_delete_deploying.md branch from e8de275 to 1873514 Compare August 22, 2026 00:30
Comment thread CONTRIBUTING.md
git push && git push --tags
```
8. Create and merge the PR
9. Deploy via [Shipit](https://shipit.shopify.io/shopify/buy-button-js/production)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

General Q - Do we want these here? Are they better as an internal doc?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah I debated this, and I think this section might be worth having in an internal doc/incident playbook instead. This info was already present before in DEPLOYING.md - I just moved it to CONTRIBUTING.md for this PR. In general though I think it doesn't hurt to have info like this co-located with the repo as if ownership changes, it's easy for playbooks to become out of date or have the information be hard to find. But I could go either way on this one!

name: Production release to npm
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true && !contains(github.event.pull_request.title, '[ROLLBACK]') && !contains(github.event.pull_request.title, '[DOCS]')
if: github.repository_owner == 'Shopify'

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I don't think I've seen this one before. Is this to ensure that someone who forked the repo isn't able to push to npm or is it something else? I figured this wouldn't be possible anyways because you need GH secrets to be able to push.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah to my knowledge you're right and forks wouldn't be able to push to npm anyway because of the lack of secrets. But apparently with this check (and it's also present in Hydrogen for example) it just makes this CI job sort of early return/stop cleanly in case it's running on a fork, rather than having this job fail later on. So not necessary but just cleaner

Replace the direct-publish npm release workflow with the two-mode
changesets/action pattern: pending changesets create a release PR
titled "[ci] release"; merging it triggers npm publish.

Why: the previous workflow published to npm immediately on PR merge.
This made it impossible to batch multiple changes from separate PRs
in a single npm release, and also meant that authors who didn't
realize that PR merge = release could accidentally publish to npm
a change that isn't ready for release.

The release PR pattern creates an intermediate PR showing exactly
what will be published before it goes out.
@kdaviduik
kdaviduik force-pushed the 03-13-chore_delete_deploying.md branch from 1873514 to 94d6858 Compare August 27, 2026 19:46
@kdaviduik
kdaviduik requested a review from EvilGenius13 August 27, 2026 20:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants