Skip to content

Commit d7adbdd

Browse files
authored
ci: move to changesets for releases (#4003)
1 parent 52b1e8f commit d7adbdd

461 files changed

Lines changed: 1104 additions & 3454 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.ado/azure-pipelines.publish.yml

Lines changed: 14 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@ parameters:
1414
displayName: Skip Npm Publish
1515
type: boolean
1616
default: false
17-
- name: skipGitPush
18-
displayName: Skip Git Push
19-
type: boolean
20-
default: false
2117
- name: skipNugetPublish
2218
displayName: Skip Nuget Publish
2319
type: boolean
@@ -70,12 +66,6 @@ extends:
7066
steps:
7167
- template: .ado/templates/setup-repo.yml@self
7268

73-
- script: |
74-
git config user.name "UI-Fabric-RN-Bot"
75-
git config user.email "uifrnbot@microsoft.com"
76-
git remote set-url origin https://$(githubUser):$(githubPAT)@github.com/microsoft/fluentui-react-native.git
77-
displayName: Git Authentication
78-
7969
- script: |
8070
yarn
8171
displayName: 'yarn install'
@@ -85,24 +75,24 @@ extends:
8575
displayName: 'yarn buildci [test]'
8676
8777
- script: |
88-
echo ##vso[task.setvariable variable=SkipNpmPublishArgs]--no-publish
89-
displayName: Enable No-Publish (npm)
90-
condition: ${{ parameters.skipNpmPublish }}
91-
92-
- script: |
93-
echo ##vso[task.setvariable variable=SkipGitPushPublishArgs]--no-push
94-
displayName: Enable No-Publish (git)
95-
condition: ${{ parameters.skipGitPush }}
78+
yarn config set npmPublishRegistry "https://registry.npmjs.org"
79+
yarn config set npmAuthToken $(npmAuth)
80+
displayName: 'Configure yarn for npm publishing'
81+
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'), not(${{ parameters.skipNpmPublish }}))
9682
9783
- script: |
98-
yarn publish:beachball $(SkipNpmPublishArgs) $(SkipGitPushPublishArgs) --access public --token $(npmAuth) -b origin/main -y
99-
displayName: 'Publish NPM Packages (for main branch)'
100-
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'))
84+
# https://github.com/changesets/changesets/issues/432
85+
# We can't use `changeset publish` because it doesn't support workspaces, so we have to publish each package individually
86+
yarn workspaces foreach --all --topological --no-private \
87+
exec zx $(Build.SourcesDirectory)/.github/scripts/publish-package-if-needed.mts
88+
displayName: 'Publish NPM Packages'
89+
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'), not(${{ parameters.skipNpmPublish }}))
10190
10291
- script: |
103-
yarn publish:beachball $(SkipNpmPublishArgs) $(SkipGitPushPublishArgs) --access public --token $(npmAuth) -y -t v${{ replace(variables['Build.SourceBranch'],'refs/heads/releases/','') }} -b origin/${{ replace(variables['Build.SourceBranch'],'refs/heads/','') }} --prerelease-prefix ${{ replace(variables['Build.SourceBranch'],'refs/heads/releases/','') }}
104-
displayName: 'Publish NPM Packages (for other release branches)'
105-
condition: and(succeeded(), ne(variables['Build.SourceBranch'], 'refs/heads/main'))
92+
yarn config unset npmAuthToken
93+
yarn config unset npmPublishRegistry
94+
displayName: 'Cleanup yarn npm config'
95+
condition: always()
10696
10797
- template: .ado/templates/win32-nuget-publish.yml@self
10898
parameters:

.changeset/beachball-migration.md

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
---
2+
"@fluentui-react-native/adapters": patch
3+
"@fluentui-react-native/android-theme": patch
4+
"@fluentui-react-native/apple-theme": patch
5+
"@fluentui-react-native/avatar": patch
6+
"@fluentui-react-native/badge": patch
7+
"@fluentui-react-native/button": patch
8+
"@fluentui-react-native/callout": patch
9+
"@fluentui-react-native/checkbox": patch
10+
"@fluentui-react-native/chip": patch
11+
"@fluentui-react-native/codemods": patch
12+
"@fluentui-react-native/composition": patch
13+
"@fluentui-react-native/contextual-menu": patch
14+
"@fluentui-react-native/default-theme": patch
15+
"@fluentui-react-native/divider": patch
16+
"@fluentui-react-native/drawer": patch
17+
"@fluentui-react-native/dropdown": patch
18+
"@fluentui-react-native/experimental-activity-indicator": patch
19+
"@fluentui-react-native/experimental-appearance-additions": patch
20+
"@fluentui-react-native/experimental-avatar": patch
21+
"@fluentui-react-native/experimental-checkbox": patch
22+
"@fluentui-react-native/experimental-expander": patch
23+
"@fluentui-react-native/experimental-menu-button": patch
24+
"@fluentui-react-native/experimental-native-date-picker": patch
25+
"@fluentui-react-native/experimental-native-font-metrics": patch
26+
"@fluentui-react-native/experimental-shadow": patch
27+
"@fluentui-react-native/experimental-shimmer": patch
28+
"@fluentui-react-native/focus-trap-zone": patch
29+
"@fluentui-react-native/focus-zone": patch
30+
"@fluentui-react-native/framework": patch
31+
"@fluentui-react-native/framework-base": patch
32+
"@fluentui-react-native/icon": patch
33+
"@fluentui-react-native/immutable-merge": patch
34+
"@fluentui-react-native/input": patch
35+
"@fluentui-react-native/interactive-hooks": patch
36+
"@fluentui-react-native/link": patch
37+
"@fluentui-react-native/memo-cache": patch
38+
"@fluentui-react-native/menu": patch
39+
"@fluentui-react-native/menu-button": patch
40+
"@fluentui-react-native/merge-props": patch
41+
"@fluentui-react-native/notification": patch
42+
"@fluentui-react-native/overflow": patch
43+
"@fluentui-react-native/persona": patch
44+
"@fluentui-react-native/persona-coin": patch
45+
"@fluentui-react-native/popover": patch
46+
"@fluentui-react-native/pressable": patch
47+
"@fluentui-react-native/radio-group": patch
48+
"@fluentui-react-native/separator": patch
49+
"@fluentui-react-native/spinner": patch
50+
"@fluentui-react-native/stack": patch
51+
"@fluentui-react-native/styling-utils": patch
52+
"@fluentui-react-native/switch": patch
53+
"@fluentui-react-native/tablist": patch
54+
"@fluentui-react-native/text": patch
55+
"@fluentui-react-native/theme": patch
56+
"@fluentui-react-native/theme-tokens": patch
57+
"@fluentui-react-native/theme-types": patch
58+
"@fluentui-react-native/themed-stylesheet": patch
59+
"@fluentui-react-native/theming-utils": patch
60+
"@fluentui-react-native/tokens": patch
61+
"@fluentui-react-native/tooltip": patch
62+
"@fluentui-react-native/use-slot": patch
63+
"@fluentui-react-native/use-slots": patch
64+
"@fluentui-react-native/use-styling": patch
65+
"@fluentui-react-native/use-tokens": patch
66+
"@fluentui-react-native/vibrancy-view": patch
67+
"@fluentui-react-native/win32-theme": patch
68+
"@fluentui/react-native": patch
69+
"@uifabricshared/foundation-composable": patch
70+
"@uifabricshared/foundation-compose": patch
71+
"@uifabricshared/foundation-settings": patch
72+
"@uifabricshared/foundation-tokens": patch
73+
"@uifabricshared/theme-registry": patch
74+
"@uifabricshared/themed-settings": patch
75+
"@uifabricshared/theming-ramp": patch
76+
"@uifabricshared/theming-react-native": patch
77+
---
78+
79+
# Migration from Beachball to Changesets
80+
81+
This changeset represents the migration from Beachball to Changesets for version management and consolidates all changes from 440+ beachball change files that were in the `change/` directory.
82+
83+
All 75 affected packages receive a patch version bump to acknowledge the accumulated changes from the beachball era.
84+
85+
## What Changed
86+
87+
Going forward, all version management uses Changesets via `yarn changeset`. The following beachball infrastructure has been removed:
88+
89+
- ❌ 440+ beachball change files from `change/` directory
90+
-`beachball` package dependency
91+
- ❌ Beachball scripts from `package.json`
92+
-`beachball.config.js` configuration file
93+
- ❌ Beachball publish steps from Azure Pipelines
94+
95+
## New Workflow
96+
97+
**Create changes**: Run `yarn changeset` to document changes
98+
**Version bump PRs**: Automatically created by GitHub Actions
99+
**Publishing**: Handled by Azure Pipelines using `changeset publish`
100+
**Validation**: CI validates changesets and blocks major version bumps
101+
102+
For details, see `CHANGESETS_SETUP.md` and `CONTRIBUTING.md`.

.changeset/config.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"$schema": "https://unpkg.com/@changesets/config@3.1.1/schema.json",
3+
"changelog": "@changesets/cli/changelog",
4+
"commit": ["@changesets/cli/commit", { "skipCI": false }],
5+
"linked": [],
6+
"access": "public",
7+
"baseBranch": "origin/main",
8+
"ignore": [
9+
"@fluentui-react-native/dependency-profiles",
10+
"@fluentui-react-native/e2e-testing",
11+
"@fluentui-react-native/tester",
12+
"@fluentui-react-native/tester-core",
13+
"@fluentui-react-native/tester-win32",
14+
"@fluentui-react-native/tester-win32-81",
15+
"@fluentui-react-native/test-*"
16+
]
17+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/usr/bin/env zx
2+
import 'zx/globals';
3+
4+
/**
5+
* Changeset version bump with post-bump hook
6+
*
7+
* This script orchestrates the version bump process:
8+
* 1. Runs changeset version to bump package versions
9+
* 2. Updates dependency-profiles with new versions
10+
* 3. Updates yarn.lock to reflect all changes
11+
*
12+
* The changesets action will automatically commit these changes.
13+
*/
14+
15+
const DEPENDENCY_PROFILES_DIR = 'packages/dependency-profiles';
16+
17+
echo('📦 Running changeset version...');
18+
await $`yarn changeset version`;
19+
20+
// Undo the commit that changeset version made, but keep the changes
21+
// This allows the changesets action to create a single commit with all changes
22+
echo('🔙 Undoing changeset commit (keeping changes)...');
23+
await $`git reset --soft HEAD~1`;
24+
25+
echo('\n🔄 Updating dependency-profiles...');
26+
if (fs.existsSync(DEPENDENCY_PROFILES_DIR)) {
27+
cd(DEPENDENCY_PROFILES_DIR);
28+
await $`yarn update-profile`;
29+
cd('../..');
30+
echo('✅ dependency-profiles updated');
31+
} else {
32+
echo('⚠️ dependency-profiles not found, skipping');
33+
}
34+
35+
echo('\n🔒 Updating yarn.lock...');
36+
await $`yarn install --mode update-lockfile`;
37+
38+
echo('\n✅ Version bump complete!');
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
#!/usr/bin/env zx
2+
import 'zx/globals';
3+
4+
// Type declaration for process (zx doesn't include Node.js types)
5+
declare const process: {
6+
env: Record<string, string | undefined>;
7+
cwd: () => string;
8+
argv: string[];
9+
exit: (code: number) => never;
10+
};
11+
12+
/**
13+
* Publish a single package to npm if needed
14+
*
15+
* This script:
16+
* - Operates on the current workspace directory
17+
* - Checks npm registry before publishing
18+
* - Skips private packages automatically
19+
*
20+
* Usage:
21+
* # In a workspace directory:
22+
* npx zx publish-package-if-needed.mts # Publish for real
23+
* npx zx publish-package-if-needed.mts --dry-run # Simulate publishing
24+
*
25+
* # For all workspaces in topological order:
26+
* yarn workspaces foreach --all --topological --no-private \
27+
* exec npx zx .github/scripts/publish-package-if-needed.mts
28+
*/
29+
30+
// Parse command line arguments
31+
const isDryRun = process.argv.includes('--dry-run');
32+
33+
// Read package.json from current directory
34+
const packageJson = JSON.parse(fs.readFileSync('package.json', 'utf-8'));
35+
const { name, version, private: isPrivate } = packageJson;
36+
37+
// Skip private packages
38+
if (isPrivate) {
39+
echo(`⊘ Skipping private package: ${name}`);
40+
process.exit(0);
41+
}
42+
43+
// Check if package@version already exists on npm
44+
const result = await $`npm view ${name}@${version} version 2>&1`.nothrow().quiet();
45+
const shouldPublish = result.exitCode !== 0 || result.stdout.trim() !== version;
46+
47+
if (!shouldPublish) {
48+
echo(`✓ Already published: ${name}@${version}`);
49+
process.exit(0);
50+
}
51+
52+
// Publish the package
53+
const startMsg = isDryRun ? 'Simulating publish' : 'Publishing';
54+
const endMsg = isDryRun ? 'Dry-run successful for' : 'Successfully published';
55+
56+
echo(`→ ${startMsg}: ${name}@${version}`);
57+
58+
const publishCmd = isDryRun
59+
? $`yarn npm publish --access public --dry-run`
60+
: $`yarn npm publish --access public`;
61+
62+
await publishCmd;
63+
echo(`✓ ${endMsg}: ${name}@${version}`);

0 commit comments

Comments
 (0)