-
Notifications
You must be signed in to change notification settings - Fork 16
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
feat: add automated release workflow #36
Conversation
Authenticated clients should be able to trigger a release with a request like: curl -X POST https://api.github.com/repos/react-native-community/template/dispatches \ -H "Accept: application/vnd.github.v3+json" \ -H "Authorization: Bearer $YOUR_TOKEN" \ -d ' "event_type": "publish", "sender": "Some useful identifier", "client_payload": " { "version": "0.75.0-rc.4", "is_latest_on_npm": true } '
723b0cc
to
832fdea
Compare
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.
Great and quick job. I left a couple of suggestions on how to improve this, if you like them!
- name: Move to MAJOR.MINOR-stable or create if it doesn't exist | ||
run: | | ||
VERSION=$(grep -E '\d+\.\d+' <<< "$VERSION" | awk '{ print "branch="$0"-stable" }') | ||
if ! git ls-remote -q --exit-code --heads origin $VERSION > /dev/null; then | ||
echo "Creating missing release branch \"$VERSION\"" | ||
git checkout -B "$VERSION" | ||
git push --set-upstream origin "$VERSION" | ||
else | ||
git checkout "$VERSION" | ||
fi |
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.
you don't need to do that. The checkout will happen in the right branch automatically.
git config --global user.email '[email protected]' | ||
git commit -am "Bumping template to $VERSION" | ||
git push | ||
git tag $VERSION |
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.
with or without the leading v
?
git tag $VERSION | |
git tag "$VERSION" |
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.
Good spot.
- name: Publish NPM | ||
run: npm publish | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
- name: Set NPM tags | ||
run: | | ||
if [[ "$VERSION" == *"rc"* ]]; then | ||
npm dist-tag add @react-native-community/template@$VERSION next | ||
fi | ||
if [[ "$GITHUB_REF_NAME" == *"-stable" ]]; then | ||
npm dist-tag add @react-native-community/template@$VERSION $GITHUB_REF_NAME | ||
fi | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
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.
Can't we remove these and make the release.yaml
job to be triggered on tags, also?
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.
+1 to this. I think having just the release.yaml
workflow do both manual/automatic release is probably the way to go
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.
Agreed, will do this.
This isn't necessary, as we're going to make cutting a MINOR branch on template part of the release process. Then it's just a case of calling the release.yaml workflow. |
Summary: Call the react-native-community/template GHA to trigger a new release when we publish a react-native release. This then waits to confirm that the package is published. See react-native-community/template#36 for the matching change Changelog: [General][Added] trigger template publish Pull Request resolved: #45327 Test Plan: Not sure on the best way forward here. Reviewed By: cipolleschi Differential Revision: D59467829 Pulled By: blakef fbshipit-source-id: 091269e7ecdae5801ac7c03a1ede54452ae99b24
Summary: Call the react-native-community/template GHA to trigger a new release when we publish a react-native release. This then waits to confirm that the package is published. See react-native-community/template#36 for the matching change Changelog: [General][Added] trigger template publish Pull Request resolved: #45327 Test Plan: Not sure on the best way forward here. Reviewed By: cipolleschi Differential Revision: D59467829 Pulled By: blakef fbshipit-source-id: 091269e7ecdae5801ac7c03a1ede54452ae99b24
Authenticated clients should be able to trigger a release with a request
like: