Skip to content

Commit 99e3ea0

Browse files
authored
ci: migrate releases from release-it to Changesets (#61)
* docs: add Changesets migration design spec Design for replacing release-it with Changesets to fix the recurring npm/git desync (publish-before-push vs the protected main branch). Mirrors the dotlottie-web release mechanism, adapted to yarn + npm-only. * docs: refine Changesets spec per review Clarify that the 5 required-status-check contexts are the ruleset's configured list (a subset of ci.yml jobs), and that the inline docs dispatch must source release fields via `gh release view` since github.event.release is unavailable on a push trigger. * docs: add Changesets migration implementation plan Bite-sized, verifiable tasks to swap release-it for Changesets, fold in the docs dispatch, ship 0.9.3, and relax branch protection. * docs: clarify dual-token usage in release docs-dispatch step * docs: note PR #60 merged and PR #48 notify-docs overlap * chore: add changesets cli and config * chore: replace release-it scripts with changesets * chore: add changeset for ios navigation crash fix * chore: align changeset config schema to installed 3.1.4 * ci: switch release workflow to changesets * ci: fold docs notification into release workflow * docs: document changeset release workflow * ci: harden release docs-dispatch step (temp payload, guard stdin) * ci: drop yarn test from release validate The repo has no test files and `jest` exits 1 without --passWithNoTests; the existing ci.yml `test` job is an empty placeholder that runs no tests. Running `yarn test` in the release validate job would fail every release. Match the original release.yml + ci.yml behavior: lint/typecheck/prepare. * chore: migrate from release-it to Changesets for versioning and publishing * fix(ci): add turbo extends for root-as-workspace Adding "." to `workspaces` (so Changesets can discover the root-published package) makes Turbo treat the repo root as a workspace package, which requires its turbo.json to declare `extends: ["//"]`. Without it Turbo fails with "invalid turbo json / No extends key found", breaking the build-web CI job. The file keeps its `pipeline` (root config) and adds `extends` (package config) so it serves both roles.
1 parent 66c15a3 commit 99e3ea0

9 files changed

Lines changed: 642 additions & 1671 deletions

File tree

.changeset/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Changesets
2+
3+
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
4+
with multi-package repos, or single-package repos to help you version and publish your code. You can
5+
find the full documentation for it [in our repository](https://github.com/changesets/changesets)
6+
7+
We have a quick list of common questions to get you started engaging with this project in
8+
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)

.changeset/config.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"$schema": "https://unpkg.com/@changesets/config@3.1.4/schema.json",
3+
"changelog": ["@changesets/changelog-github", { "repo": "LottieFiles/dotlottie-react-native" }],
4+
"commit": false,
5+
"linked": [],
6+
"access": "public",
7+
"baseBranch": "main",
8+
"updateInternalDependencies": "patch",
9+
"ignore": ["dotlottie-react-native-example", "dotlottie-react-native-expo-example"],
10+
"prettier": false
11+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@lottiefiles/dotlottie-react-native": patch
3+
---
4+
5+
Fix crash when navigating away on iOS (bump dotlottie-ios to 0.15.6).

.github/workflows/notify-docs.yml

Lines changed: 0 additions & 28 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 77 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,22 @@
11
name: Release
22

33
on:
4+
push:
5+
branches: [main]
46
workflow_dispatch:
57

8+
concurrency:
9+
group: release
10+
cancel-in-progress: false
11+
12+
permissions: {}
13+
614
jobs:
7-
release:
15+
validate:
16+
name: Validate
817
runs-on: ubuntu-latest
918
permissions:
10-
contents: write
11-
id-token: write
19+
contents: read
1220
steps:
1321
- name: Checkout
1422
uses: actions/checkout@v4
@@ -27,13 +35,72 @@ jobs:
2735
- name: Build package
2836
run: yarn prepare
2937

30-
- name: Setup Git
31-
run: |
32-
git config --global user.name "github-actions[bot]"
33-
git config --global user.email "github-actions[bot]@users.noreply.github.com"
34-
git status
38+
release:
39+
name: Release
40+
needs: validate
41+
runs-on: ubuntu-latest
42+
if: github.repository == 'LottieFiles/dotlottie-react-native'
43+
permissions:
44+
contents: write
45+
id-token: write
46+
pull-requests: write
47+
outputs:
48+
published: ${{ steps.changesets.outputs.published }}
49+
publishedPackages: ${{ steps.changesets.outputs.publishedPackages }}
50+
steps:
51+
- name: Checkout
52+
uses: actions/checkout@v4
53+
with:
54+
fetch-depth: 0
55+
persist-credentials: false
3556

36-
- name: Release
37-
run: yarn release
57+
- name: Setup
58+
uses: ./.github/actions/setup
59+
60+
- name: Create Release PR or Publish
61+
id: changesets
62+
uses: changesets/action@63a615b9cd06ba9a3e6d13796c7fbcb080a60a0b # v1.8.0
63+
with:
64+
version: yarn release:version
65+
publish: yarn release:publish
66+
commit: "chore: release"
67+
title: "chore: release"
68+
createGithubReleases: true
3869
env:
3970
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
71+
NPM_CONFIG_PROVENANCE: "true"
72+
73+
- name: Notify docs-content
74+
if: steps.changesets.outputs.published == 'true'
75+
env:
76+
GH_TOKEN: ${{ secrets.DOCS_CONTENT_SYNC_TOKEN }}
77+
REPO_TOKEN: ${{ github.token }}
78+
PUBLISHED: ${{ steps.changesets.outputs.publishedPackages }}
79+
SENDER: ${{ github.actor }}
80+
SOURCE_REPO: ${{ github.repository }}
81+
run: |
82+
# Release lookups use the repo token (REPO_TOKEN); only the final
83+
# docs-content dispatch uses the default GH_TOKEN (DOCS_CONTENT_SYNC_TOKEN).
84+
PAYLOAD="${RUNNER_TEMP}/payload.json"
85+
while read -r PKG; do
86+
VERSION=$(jq -r '.version' <<<"$PKG")
87+
NAME=$(jq -r '.name' <<<"$PKG")
88+
# Single-package repo -> changesets tags as v<version>. Fall back to <name>@<version>.
89+
TAG="v${VERSION}"
90+
if ! GH_TOKEN="$REPO_TOKEN" gh release view "$TAG" --repo "$SOURCE_REPO" >/dev/null 2>&1 </dev/null; then
91+
TAG="${NAME}@${VERSION}"
92+
fi
93+
94+
REL=$(GH_TOKEN="$REPO_TOKEN" gh release view "$TAG" --repo "$SOURCE_REPO" --json name,body,url </dev/null)
95+
96+
jq -n \
97+
--arg source_repo "$SOURCE_REPO" \
98+
--arg source_package "" \
99+
--arg release_tag "$TAG" \
100+
--argjson rel "$REL" \
101+
--arg sender "$SENDER" \
102+
'{event_type:"dotlottie-docs-eval", client_payload:{source_repo:$source_repo, source_package:$source_package, release_tag:$release_tag, release_name:$rel.name, release_body:$rel.body, release_url:$rel.url, sender:$sender}}' \
103+
> "$PAYLOAD"
104+
105+
gh api --method POST "/repos/LottieFiles/docs-content/dispatches" --input "$PAYLOAD" </dev/null
106+
done < <(echo "$PUBLISHED" | jq -c '.[]')

CONTRIBUTING.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,16 +87,20 @@ We use [TypeScript](https://www.typescriptlang.org/) for type checking, [ESLint]
8787

8888
Our pre-commit hooks verify that the linter and tests pass when committing.
8989

90-
### Publishing to npm
90+
### Releasing
9191

92-
We use [release-it](https://github.com/release-it/release-it) to make it easier to publish new versions. It handles common tasks like bumping version based on semver, creating tags and releases etc.
92+
We use [Changesets](https://github.com/changesets/changesets) to version and publish the package.
9393

94-
To publish new versions, run the following:
94+
When you make a change that should be released, add a changeset in your PR:
9595

9696
```sh
97-
yarn release
97+
yarn changeset
9898
```
9999

100+
Pick the bump type (patch/minor/major) and write a short summary — this becomes the changelog entry. Commit the generated file under `.changeset/`.
101+
102+
Releases are automated: when changesets land on `main`, a bot opens a **"Version Packages"** PR that bumps the version and updates `CHANGELOG.md`. Merging that PR publishes the new version to npm (with provenance), tags it, and creates a GitHub release.
103+
100104
### Scripts
101105

102106
The `package.json` file contains various scripts for common tasks:

package.json

Lines changed: 5 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@
5858
"lint": "eslint \"**/*.{js,ts,tsx}\"",
5959
"clean": "del-cli android/build example/android/build example/android/app/build example/ios/build example/dist lib",
6060
"prepare": "bob build",
61-
"release": "release-it"
61+
"release:version": "changeset version",
62+
"release:publish": "yarn prepare && changeset publish"
6263
},
6364
"keywords": [
6465
"react-native",
@@ -89,11 +90,12 @@
8990
"access": "public"
9091
},
9192
"devDependencies": {
93+
"@changesets/changelog-github": "^0.7.0",
94+
"@changesets/cli": "^2.31.0",
9295
"@commitlint/config-conventional": "^17.0.2",
9396
"@evilmartians/lefthook": "^1.5.0",
9497
"@expo/config-plugins": "^8.0.0",
9598
"@react-native/eslint-config": "^0.73.1",
96-
"@release-it/conventional-changelog": "^10.0.1",
9799
"@types/jest": "^29.5.13",
98100
"@types/react": "^18.2.44",
99101
"commitlint": "^17.0.2",
@@ -106,7 +108,6 @@
106108
"react": "19.1.0",
107109
"react-native": "0.81.4",
108110
"react-native-builder-bob": "^0.29.0",
109-
"release-it": "^19.0.5",
110111
"turbo": "^1.10.7",
111112
"typescript": "^5.2.2"
112113
},
@@ -119,6 +120,7 @@
119120
"react-native": "*"
120121
},
121122
"workspaces": [
123+
".",
122124
"example",
123125
"expo-example"
124126
],
@@ -135,30 +137,6 @@
135137
"@commitlint/config-conventional"
136138
]
137139
},
138-
"release-it": {
139-
"$schema": "https://unpkg.com/release-it@19/schema/release-it.json",
140-
"git": {
141-
"commitMessage": "chore: release ${version}",
142-
"tagName": "v${version}",
143-
"requireCleanWorkingDir": false
144-
},
145-
"npm": {
146-
"publish": true,
147-
"skipChecks": true,
148-
"publishArgs": [
149-
"--provenance --access public"
150-
]
151-
},
152-
"github": {
153-
"release": true
154-
},
155-
"plugins": {
156-
"@release-it/conventional-changelog": {
157-
"preset": "conventionalcommits",
158-
"infile": "CHANGELOG.md"
159-
}
160-
}
161-
},
162140
"eslintConfig": {
163141
"root": true,
164142
"extends": [

turbo.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"$schema": "https://turbo.build/schema.json",
3+
"extends": ["//"],
34
"pipeline": {
45
"build:android": {
56
"inputs": [

0 commit comments

Comments
 (0)