[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
lauren committed
Apr 21, 2025 at 14:43 UTC
efd890422db30a426bf395866ac3ec90573bbfd0
3 files changed
+18
-2
.github/workflows/compiler_prereleases.yml
+4
-1
@@ -16,6 +16,9 @@ on:
16
version_name:
17
required: true
18
type: string
19
+ tag_version:
20
+ required: false
21
+ type: number
22
secrets:
23
NPM_TOKEN:
24
required: true
@@ -55,4 +58,4 @@ jobs:
58
- name: Publish packages to npm
59
run: |
60
cp ./scripts/release/ci-npmrc ~/.npmrc
58
- scripts/release/publish.js --frfr --ci --versionName=${{ inputs.version_name }} --tag ${{ inputs.dist_tag }}
61
+ scripts/release/publish.js --frfr --ci --versionName=${{ inputs.version_name }} --tag=${{ inputs.dist_tag }} ${{ inputs.tag_version && format('--tagVersion={0}', inputs.tag_version) || '' }}
.github/workflows/compiler_prereleases_manual.yml
+4
@@ -14,6 +14,9 @@ on:
14
version_name:
15
required: true
16
type: string
17
+ tag_version:
18
+ required: false
19
+ type: number
20
21
permissions: {}
22
@@ -29,5 +32,6 @@ jobs:
32
release_channel: ${{ inputs.release_channel }}
33
dist_tag: ${{ inputs.dist_tag }}
34
version_name: ${{ inputs.version_name }}
35
+ tag_version: ${{ inputs.tag_version }}
36
secrets:
37
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
compiler/scripts/release/publish.js
+10
-1
@@ -65,6 +65,12 @@ async function main() {
65
choices: ['experimental', 'beta', 'rc'],
66
default: 'experimental',
67
})
68
+ .option('tag-version', {
69
+ description:
70
+ 'Optional tag version to append to tag name, eg `1` becomes 0.0.0-rc.1',
71
+ type: 'number',
72
+ default: null,
73
+ })
74
.option('version-name', {
75
description: 'Version name',
76
type: 'string',
@@ -133,7 +139,10 @@ async function main() {
139
files: {exclude: ['.DS_Store']},
140
});
141
const truncatedHash = hash.slice(0, 7);
136
- const newVersion = `${argv.versionName}-${argv.tag}-${truncatedHash}-${dateString}`;
142
+ const newVersion =
143
+ argv.tagVersion == null || argv.tagVersion === ''
144
+ ? `${argv.versionName}-${argv.tag}-${truncatedHash}-${dateString}`
145
+ : `${argv.versionName}-${argv.tag}.${argv.tagVersion}-${truncatedHash}-${dateString}`;
146
147
for (const pkgName of pkgNames) {
148
const pkgDir = path.resolve(__dirname, `../../packages/${pkgName}`);