mirror of
https://github.com/transloadit/uppy.git
synced 2026-01-23 02:25:07 +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
17
.github/workflows/release.yml
vendored
17
.github/workflows/release.yml
vendored
|
|
@ -78,23 +78,6 @@ jobs:
|
|||
EDGLY_KEY: ${{secrets.EDGLY_KEY}}
|
||||
EDGLY_SECRET: ${{secrets.EDGLY_SECRET}}
|
||||
|
||||
- name: Update CDN version references
|
||||
if: steps.changesets.outputs.published == 'true'
|
||||
run: |
|
||||
VERSION=$(yarn workspace uppy exec npm pkg get version | grep -o '"[0-9]*\.[0-9]*\.[0-9]*"' | tr -d '"')
|
||||
sed -i "s|https://releases\.transloadit\.com/uppy/v[0-9]*\.[0-9]*\.[0-9]*/|https://releases.transloadit.com/uppy/v$VERSION/|g" README.md
|
||||
sed -i "s|https://releases\.transloadit\.com/uppy/v[0-9]*\.[0-9]*\.[0-9]*/|https://releases.transloadit.com/uppy/v$VERSION/|g" BUNDLE-README.md
|
||||
|
||||
- name: Commit README updates
|
||||
if: steps.changesets.outputs.published == 'true'
|
||||
run: |
|
||||
git config --local user.email "action@github.com"
|
||||
git config --local user.name "GitHub Action"
|
||||
git add README.md BUNDLE-README.md
|
||||
git commit -m "Update CDN version references to latest release" || exit 0
|
||||
git push
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
# See also companion-deploy.yml
|
||||
docker:
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
Hi, thanks for trying out the bundled version of the Uppy File Uploader. You can
|
||||
use this from a CDN
|
||||
(`<script src="https://releases.transloadit.com/uppy/v/uppy.min.js"></script>`)
|
||||
(`<script src="https://releases.transloadit.com/uppy/v4.18.1/uppy.min.js"></script>`)
|
||||
or bundle it with your webapp.
|
||||
|
||||
Note that the recommended way to use Uppy is to install it with yarn/npm and use
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ npm install @uppy/core @uppy/dashboard @uppy/tus
|
|||
```
|
||||
|
||||
Add CSS
|
||||
[uppy.min.css](https://releases.transloadit.com/uppy/v/uppy.min.css),
|
||||
[uppy.min.css](https://releases.transloadit.com/uppy/v4.18.1/uppy.min.css),
|
||||
either to your HTML page’s `<head>` or include in JS, if your bundler of choice
|
||||
supports it.
|
||||
|
||||
|
|
@ -117,7 +117,7 @@ CDN. In that case `Uppy` will attach itself to the global `window.Uppy` object.
|
|||
```html
|
||||
<!-- 1. Add CSS to `<head>` -->
|
||||
<link
|
||||
href="https://releases.transloadit.com/uppy/v/uppy.min.css"
|
||||
href="https://releases.transloadit.com/uppy/v4.18.1/uppy.min.css"
|
||||
rel="stylesheet"
|
||||
/>
|
||||
|
||||
|
|
@ -128,7 +128,7 @@ CDN. In that case `Uppy` will attach itself to the global `window.Uppy` object.
|
|||
Uppy,
|
||||
Dashboard,
|
||||
Tus,
|
||||
} from 'https://releases.transloadit.com/uppy/v/uppy.min.mjs'
|
||||
} from 'https://releases.transloadit.com/uppy/v4.18.1/uppy.min.mjs'
|
||||
|
||||
const uppy = new Uppy()
|
||||
uppy.use(Dashboard, { target: '#files-drag-drop' })
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
"includes": [
|
||||
"packages/**",
|
||||
"examples/**",
|
||||
"scripts/**",
|
||||
"bin/**",
|
||||
"e2e/**",
|
||||
"private/**",
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
"test": "turbo run test --filter='./packages/@uppy/*' --filter='./packages/uppy' --filter='./examples/{react,vue,sveltekit}'",
|
||||
"test:watch": "turbo watch test --filter='./packages/@uppy/*' --filter='./packages/uppy'",
|
||||
"typecheck": "turbo run typecheck --filter='./packages/@uppy/*' --filter='./packages/uppy'",
|
||||
"version": "changeset version && corepack yarn install --mode=update-lockfile",
|
||||
"version": "changeset version && corepack yarn install --mode=update-lockfile && node scripts/update-readme-versions.mjs",
|
||||
"release": "changeset publish"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
|
|
|||
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