diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..d1c1eef --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,46 @@ +name: Release + +on: + push: + tags: + - "[0-9]+.[0-9]+.[0-9]+" + +permissions: + contents: write + # npm trusted publishing: the package is published with an OIDC token and + # gets provenance, so no NPM_TOKEN secret is stored. + id-token: write + +jobs: + publish: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: lts/* + cache: npm + registry-url: https://registry.npmjs.org + + # Trusted publishing needs npm 11.5.1 or newer. + - run: npm install -g npm@latest + + - name: Check the tag matches package.json + run: | + version=$(node -p "require('./package.json').version") + if [ "$version" != "$GITHUB_REF_NAME" ]; then + echo "Tag $GITHUB_REF_NAME does not match package.json version $version" + exit 1 + fi + + - run: npm ci + - run: npm test + - run: npm run build:size + - run: npm publish + + - name: Create the GitHub release from CHANGELOG.md + env: + GH_TOKEN: ${{ github.token }} + run: | + awk -v v="$GITHUB_REF_NAME" '/^## /{ if (f) exit; f = ($2 == v); next } f' CHANGELOG.md > notes.md + gh release create "$GITHUB_REF_NAME" --verify-tag --title "$GITHUB_REF_NAME" --notes-file notes.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..b575c78 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,45 @@ +# Changelog + +## 1.0.1 + +- `exports` names the type file for each entry and module format, so TypeScript picks `.d.ts` for `import` and `.d.cts` for `require` without guessing. +- The package ships `CHANGELOG.md`, and `author` names the maintainer. + +## 1.0.0 + +The default entry now sanitizes, and React Native gets its own entry. + +### Breaking changes + +- **React 18 or newer.** The `react` peer range moves from `>=16.8.0` to `>=18.0.0`. The native entry also needs `react-native >=0.71`. +- **`parse` sanitizes by default.** `parse` from `react-html5-parser` runs DOMPurify over the parsed tree. Output that used to render can now be stripped: + - `