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

[CI] [npm] Deploy to npm on tagged commits only #21250

Closed
wants to merge 1 commit into from

Conversation

hramos
Copy link
Contributor

@hramos hramos commented Sep 21, 2018

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

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Sep 21, 2018
* 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;
Copy link
Contributor Author

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:
Copy link
Contributor Author

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
Copy link
Contributor Author

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.

@facebook-github-bot facebook-github-bot added the Import Started This pull request has been imported. This does not imply the PR has been approved. label Sep 22, 2018
Copy link
Contributor

@facebook-github-bot facebook-github-bot left a 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.

@react-native-bot
Copy link
Collaborator

@hramos merged commit b094600 into facebook:master.


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 master tag, it is not yet part of a release.

@facebook facebook locked as resolved and limited conversation to collaborators Sep 22, 2018
@react-native-bot react-native-bot added the Merged This PR has been merged. label Sep 22, 2018
@hramos hramos deleted the tagged-deploys branch September 22, 2018 16:59
@hramos hramos removed Import Started This pull request has been imported. This does not imply the PR has been approved. labels Feb 6, 2019
t-nanava pushed a commit to microsoft/react-native-macos that referenced this pull request Jun 17, 2019
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
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged This PR has been merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants