diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 04ab22307..8211dc8df 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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: diff --git a/BUNDLE-README.md b/BUNDLE-README.md index 5055518e2..16260316f 100644 --- a/BUNDLE-README.md +++ b/BUNDLE-README.md @@ -2,7 +2,7 @@ Hi, thanks for trying out the bundled version of the Uppy File Uploader. You can use this from a CDN -(``) +(``) or bundle it with your webapp. Note that the recommended way to use Uppy is to install it with yarn/npm and use diff --git a/README.md b/README.md index 2b2510661..a7d87cc43 100644 --- a/README.md +++ b/README.md @@ -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 `` 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 @@ -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' }) diff --git a/biome.json b/biome.json index 6518554fc..b64655d63 100644 --- a/biome.json +++ b/biome.json @@ -10,6 +10,7 @@ "includes": [ "packages/**", "examples/**", + "scripts/**", "bin/**", "e2e/**", "private/**", diff --git a/package.json b/package.json index ef82e8ded..b0aa7f734 100644 --- a/package.json +++ b/package.json @@ -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": { diff --git a/scripts/update-readme-versions.mjs b/scripts/update-readme-versions.mjs new file mode 100644 index 000000000..7ce8a1fa4 --- /dev/null +++ b/scripts/update-readme-versions.mjs @@ -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') +}