[compiler] Fix version name in publish script (#32979)

Add ability to specify an optional tagVersion which is appended to the
version name + tag, eg

19.1.0-rc.1
---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/facebook/react/pull/32979).
* __->__ #32979
* #32978
This commit is contained in:
lauren
2025-04-21 14:43:20 -04:00
committed by GitHub
parent b303610c33
commit efd890422d
3 changed files with 18 additions and 2 deletions

View File

@@ -16,6 +16,9 @@ on:
version_name:
required: true
type: string
tag_version:
required: false
type: number
secrets:
NPM_TOKEN:
required: true
@@ -55,4 +58,4 @@ jobs:
- name: Publish packages to npm
run: |
cp ./scripts/release/ci-npmrc ~/.npmrc
scripts/release/publish.js --frfr --ci --versionName=${{ inputs.version_name }} --tag ${{ inputs.dist_tag }}
scripts/release/publish.js --frfr --ci --versionName=${{ inputs.version_name }} --tag=${{ inputs.dist_tag }} ${{ inputs.tag_version && format('--tagVersion={0}', inputs.tag_version) || '' }}

View File

@@ -14,6 +14,9 @@ on:
version_name:
required: true
type: string
tag_version:
required: false
type: number
permissions: {}
@@ -29,5 +32,6 @@ jobs:
release_channel: ${{ inputs.release_channel }}
dist_tag: ${{ inputs.dist_tag }}
version_name: ${{ inputs.version_name }}
tag_version: ${{ inputs.tag_version }}
secrets:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

View File

@@ -65,6 +65,12 @@ async function main() {
choices: ['experimental', 'beta', 'rc'],
default: 'experimental',
})
.option('tag-version', {
description:
'Optional tag version to append to tag name, eg `1` becomes 0.0.0-rc.1',
type: 'number',
default: null,
})
.option('version-name', {
description: 'Version name',
type: 'string',
@@ -133,7 +139,10 @@ async function main() {
files: {exclude: ['.DS_Store']},
});
const truncatedHash = hash.slice(0, 7);
const newVersion = `${argv.versionName}-${argv.tag}-${truncatedHash}-${dateString}`;
const newVersion =
argv.tagVersion == null || argv.tagVersion === ''
? `${argv.versionName}-${argv.tag}-${truncatedHash}-${dateString}`
: `${argv.versionName}-${argv.tag}.${argv.tagVersion}-${truncatedHash}-${dateString}`;
for (const pkgName of pkgNames) {
const pkgDir = path.resolve(__dirname, `../../packages/${pkgName}`);