Release #28
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: "The version of the react-native we the template to use in this release. For example 0.75.0-rc.0" | |
required: true | |
type: string | |
is_latest_on_npm: | |
description: "Whether we want to tag this template release as `latest` on NPM" | |
required: true | |
type: boolean | |
default: false | |
dry_run: | |
description: "Run without making persistent changes to git or npm" | |
type: boolean | |
default: true | |
jobs: | |
publish_template: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Safeguard against branch name | |
run: | | |
if [[ "$GITHUB_REF_NAME" != *-stable ]]; then | |
echo "Error: This workflow can only be executed from a branch ending with '-stable'." | |
exit 1 | |
fi | |
- name: Checkout | |
uses: actions/[email protected] | |
- name: Setup node.js | |
uses: actions/[email protected] | |
with: | |
node-version: 18 | |
registry-url: 'https://registry.npmjs.org' | |
- name: Determine new template version | |
run: echo "VERSION=$(./scripts/bumpedTemplateVersion.sh ${{ inputs.version }})" >> $GITHUB_ENV | |
- name: Update versions to input one | |
run: node ./scripts/updateTemplateVersion.js $VERSION | |
- name: Update template/package.json to nightly react-native + @react-native | |
run: node ./scripts/updateReactNativeVersion.js "${{ inputs.version }}" | |
- name: Create corresponding commit & git tag | |
run: | | |
GIT=(echo git) | |
if [ "${{ inputs.dry_run }}" = "false" ]; then | |
GIT=(git) | |
fi | |
"${GIT[@]}" config --global user.name 'React Native Bot' | |
"${GIT[@]}" config --global user.email '[email protected]' | |
"${GIT[@]}" commit -am "Bumping template to $VERSION" | |
"${GIT[@]}" push | |
"${GIT[@]}" tag $VERSION | |
"${GIT[@]}" push --tags | |
- name: Publish NPM | |
run: npm publish | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Set NPM tags | |
run: | | |
NPM=(echo npm) | |
if [ "${{ inputs.dry_run }}" = "false" ]; then | |
NPM=(npm) | |
fi | |
IS_LATEST_ON_NPM="${{ inputs.is_latest_on_npm }}" | |
if [[ "$IS_LATEST_ON_NPM" == "true" ]]; then | |
"${NPM[@]}" dist-tag add @react-native-community/template@$VERSION latest | |
fi | |
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 }} |