-
Notifications
You must be signed in to change notification settings - Fork 24.5k
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
[CI] [npm] Deploy to npm on tagged commits only #21250
Conversation
* If tag v0.XY.Z is present on the commit then publish to npm with version 0.XY.Z and no tag (npm will consider it latest) | ||
*/ | ||
|
||
/*eslint-disable no-undef */ | ||
require('shelljs/global'); | ||
|
||
const buildBranch = process.env.CIRCLE_BRANCH; | ||
const buildTag = process.env.CIRCLE_TAG; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are no longer running the publish_npm_package
job on stable branches, but rather we look for the actual git tag (e.g. v0.57.1, see Circle CI config).
$CIRCLE_TAG is available when a Circle CI job is initiated due to a commit that matches the pattern established in .circleci/config.yml
.
This envvar is empty when a job is initiated due to a commit to a branch, so we need to switch to using $CIRCLE_TAG instead.
@@ -677,12 +677,11 @@ workflows: | |||
# Only runs on vX.X.X tags if all tests are green | |||
- publish_npm_package: | |||
filters: | |||
branches: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prior to removing this block, we'd end up with two separate publish_npm_package
jobs.
Removing it ensures we only run that job on commits that are tagged with a string that matches /v[0-9]+(.[0-9]+)*(-rc(.[0-9]+)?)?/ (from the tags:
block).
tags: | ||
only: /v[0-9]+(\.[0-9]+)*(\-rc(\.[0-9]+)?)?/ | ||
requires: | ||
- analyze |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Circle CI is more stable these days, let's avoid pushing a release when tests are red.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hramos is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
@hramos merged commit b094600 into Once this commit is added to a release, you will see the corresponding version tag below the description at b094600. If the commit has a single |
Summary: This PR applies some fixes I made to the 0.57-stable branch to ensure we only run on commits tagged as "v0.57.1", as an example. This also ensures we only deploy after all tests pass. Pull Request resolved: facebook#21250 Differential Revision: D10003666 Pulled By: hramos fbshipit-source-id: 22d5e674ca925dce53d0ddf0e12c64dc82ec7aa1
This PR applies some fixes I made to the 0.57-stable branch to ensure we only run on commits tagged as "v0.57.1", as an example. This also ensures we only deploy after all tests pass.
Test Plan:
Tested on Circle CI
Release Notes:
[INTERNAL] [BUGFIX] [CircleCI] - Ensure releases are attempted only on tagged commits