mirror of
https://github.com/transloadit/uppy.git
synced 2026-07-17 16:50:22 +00:00
Update versions in readme's after release (#5883)
It didn't work in CI: https://github.com/transloadit/uppy/actions/runs/16771298008/job/47486827416#step:16:1 Instead of trying to hack in an extra commit, now a script runs on the `version` command, which resolves the versions based on changesets, which is ran before `publish` so it should become part of the changeset commit (hopefully)
This commit is contained in:
parent
ea04a4d5fe
commit
a12a6ce4c3
6 changed files with 52 additions and 22 deletions
46
scripts/update-readme-versions.mjs
Normal file
46
scripts/update-readme-versions.mjs
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
import { execSync } from 'node:child_process'
|
||||
import { readFileSync, writeFileSync } from 'node:fs'
|
||||
|
||||
// Get the current uppy version
|
||||
const packageJsonOutput = execSync(
|
||||
'yarn workspace uppy exec npm pkg get version',
|
||||
{ encoding: 'utf8' },
|
||||
)
|
||||
const versionMatch = packageJsonOutput.match(/"([0-9]+\.[0-9]+\.[0-9]+)"/)
|
||||
|
||||
if (!versionMatch) {
|
||||
console.log('Could not extract version from package.json')
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
const version = versionMatch[1]
|
||||
|
||||
// Update README.md
|
||||
const readme = readFileSync('README.md', 'utf8')
|
||||
const updatedReadme = readme.replace(
|
||||
/https:\/\/releases\.transloadit\.com\/uppy\/v[0-9]+\.[0-9]+\.[0-9]+\//g,
|
||||
`https://releases.transloadit.com/uppy/v${version}/`,
|
||||
)
|
||||
|
||||
if (readme !== updatedReadme) {
|
||||
writeFileSync('README.md', updatedReadme)
|
||||
console.log('Updated README.md')
|
||||
} else {
|
||||
console.log('README.md already up to date')
|
||||
}
|
||||
|
||||
// Update BUNDLE-README.md
|
||||
const bundleReadme = readFileSync('BUNDLE-README.md', 'utf8')
|
||||
const updatedBundleReadme = bundleReadme.replace(
|
||||
/https:\/\/releases\.transloadit\.com\/uppy\/v[0-9]+\.[0-9]+\.[0-9]+\//g,
|
||||
`https://releases.transloadit.com/uppy/v${version}/`,
|
||||
)
|
||||
|
||||
if (bundleReadme !== updatedBundleReadme) {
|
||||
writeFileSync('BUNDLE-README.md', updatedBundleReadme)
|
||||
console.log('Updated BUNDLE-README.md')
|
||||
} else {
|
||||
console.log('BUNDLE-README.md already up to date')
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue