Skip to content

Conversation

@daniel-graham-amplitude
Copy link
Collaborator

@daniel-graham-amplitude daniel-graham-amplitude commented Dec 4, 2025

Summary

Merged the pre-release and publish-v2 workflow into one job. This is so that pre-releases can be published without the need for NPM tokens.

To make a pre-release now, run publish-v2 and select "prerelease" from this dropdown

Screenshot 2025-12-08 at 5 26 01 AM

Checklist

  • Does your PR title have the correct title format?
  • Does your PR have a breaking change?:

Note

Consolidates prerelease into publish-v2 with new inputs and branch checks, replaces repeated steps with a reusable build-and-test composite action, and removes the old prerelease workflow.

  • CI/CD Workflows
    • Merge prerelease into /.github/workflows/publish-v2.yml with releaseType (release/prerelease/dry-run) and optional branch input.
    • Add branch protection check ensuring runs from main for release.
    • Split jobs by type:
      • deploy runs only for release and uses PUBLISH_FROM input; keeps lerna versioning and NPM publish.
      • prerelease handles prerelease/dry-run, determines target branch, computes PREID, runs versioning and (for prerelease) publish from git.
    • Replace inline install/build/test/lint steps with reusable composite action.
    • Remove obsolete workflow /.github/workflows/feature-branch-prerelease.yml.
  • Reusable Composite Action
    • Add /.github/actions/build-and-test/action.yml to cache deps, set up Node, install, build, test, lint, set Git user, and configure AWS credentials.

Written by Cursor Bugbot for commit 81df507. Configure here.

@daniel-graham-amplitude daniel-graham-amplitude marked this pull request as draft December 4, 2025 22:28
Copy link
Collaborator

@lewgordon-amplitude lewgordon-amplitude left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR consolidates the pre-release and publish-v2 workflows into a single workflow, eliminating the need for NPM tokens by using OIDC authentication instead. Users can now trigger pre-releases through the publish-v2 workflow by selecting a release type from a dropdown menu.

Key Changes

  • Added a releaseType input to the publish-v2 workflow with options: release, prerelease, and dry-run
  • Migrated the prerelease job from feature-branch-prerelease.yml into publish-v2.yml with OIDC support
  • Deleted the standalone feature-branch-prerelease.yml workflow file

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
.github/workflows/publish-v2.yml Added releaseType input parameter, conditional logic to run deploy job only for releases, and new prerelease job that handles both prerelease and dry-run operations using OIDC authentication
.github/workflows/feature-branch-prerelease.yml Removed entire workflow file as its functionality has been migrated to publish-v2.yml

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@daniel-graham-amplitude
Copy link
Collaborator Author

bugbot run

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Comment @cursor review or bugbot run to trigger another review on this PR

Copy link
Contributor

@Mercy811 Mercy811 left a comment

Choose a reason for hiding this comment

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

Should we only allow "release" from main branch?

@daniel-graham-amplitude
Copy link
Collaborator Author

@Mercy811 the trusted publishing policy will prevent the release from any branch other than 'main'.

Which makes me realize, this isn't going to work (in it's current form at least) because pre-releases need to be run from a branch other than main, but Trusted Publishing only works on main

@daniel-graham-amplitude
Copy link
Collaborator Author

@Mercy811 I just updated it so that you have to run pre-release from main, but it will check out the branch that you specify to be "pre-released".

Copy link
Contributor

@Mercy811 Mercy811 left a comment

Choose a reason for hiding this comment

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

@daniel-graham-amplitude
Copy link
Collaborator Author

bugbot run

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Comment @cursor review or bugbot run to trigger another review on this PR

shell: bash
run: |
git config --global user.name amplitude-sdk-bot
git config --global user.email [email protected]
Copy link

Choose a reason for hiding this comment

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

Bug: Git user changed from amplitude-sdk-dev to amplitude-sdk-bot

The composite action configures Git with amplitude-sdk-bot user, but the original publish-v2.yml deploy job used amplitude-sdk-dev (the removed lines show git config --global user.name amplitude-sdk-dev and email [email protected]). This means releases will now be attributed to a different GitHub account than before, which may affect commit attribution, permissions, or downstream systems that depend on the author identity.

Fix in Cursor Fix in Web

echo "branch=${{ github.event.inputs.branch }}" >> $GITHUB_OUTPUT
else
echo "branch=${{ github.ref_name }}" >> $GITHUB_OUTPUT
fi
Copy link

Choose a reason for hiding this comment

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

Bug: Prerelease defaults to main branch when unspecified

The branch input description says "Leave empty to use current branch," but due to the branch protection check on lines 29-35, the workflow can only run from main. When the branch input is empty, the fallback github.ref_name will always be "main". This means running a prerelease without specifying a branch creates versions like 1.0.0-main.0 from the main branch, which contradicts the job name "Prerelease feature branch" and is likely unintended behavior. Users expecting "current branch" to mean their feature branch will accidentally release from main.

Additional Locations (1)

Fix in Cursor Fix in Web

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.

4 participants