Skip to content

Commit efd8904

Browse files
authored
[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
1 parent b303610 commit efd8904

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

.github/workflows/compiler_prereleases.yml

+4-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ on:
1616
version_name:
1717
required: true
1818
type: string
19+
tag_version:
20+
required: false
21+
type: number
1922
secrets:
2023
NPM_TOKEN:
2124
required: true
@@ -55,4 +58,4 @@ jobs:
5558
- name: Publish packages to npm
5659
run: |
5760
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
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ on:
1414
version_name:
1515
required: true
1616
type: string
17+
tag_version:
18+
required: false
19+
type: number
1720

1821
permissions: {}
1922

@@ -29,5 +32,6 @@ jobs:
2932
release_channel: ${{ inputs.release_channel }}
3033
dist_tag: ${{ inputs.dist_tag }}
3134
version_name: ${{ inputs.version_name }}
35+
tag_version: ${{ inputs.tag_version }}
3236
secrets:
3337
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

compiler/scripts/release/publish.js

+10-1
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,12 @@ async function main() {
6565
choices: ['experimental', 'beta', 'rc'],
6666
default: 'experimental',
6767
})
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+
})
6874
.option('version-name', {
6975
description: 'Version name',
7076
type: 'string',
@@ -133,7 +139,10 @@ async function main() {
133139
files: {exclude: ['.DS_Store']},
134140
});
135141
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}`;
137146

138147
for (const pkgName of pkgNames) {
139148
const pkgDir = path.resolve(__dirname, `../../packages/${pkgName}`);

0 commit comments

Comments
 (0)