Skip to content

Commit 876e115

Browse files
ci: implement changesets
1 parent 30852f2 commit 876e115

File tree

8 files changed

+594
-39
lines changed

8 files changed

+594
-39
lines changed

.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: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
3+
"changelog": ["@changesets/cli/changelog", { "repo": "opennextjs/opennextjs-cloudflare" }],
4+
"commit": false,
5+
"fixed": [],
6+
"linked": [],
7+
"access": "public",
8+
"baseBranch": "main",
9+
"updateInternalDependencies": "patch",
10+
"ignore": [],
11+
"privatePackages": false
12+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { execSync } from "node:child_process";
2+
3+
// This script is used by the `changesets.yml` workflow to update the version of the packages being released.
4+
// The standard step is only to run `changeset version` but this does not update the package-lock.json file.
5+
// So we also run `npm install`, which does this update.
6+
// This is a workaround until this is handled automatically by `changeset version`.
7+
// See https://github.com/changesets/changesets/issues/421.
8+
9+
// Run standard `changeset version` command to apply changesets, bump versions, and update changelogs
10+
execSync("pnpm exec changeset version", { stdio: "inherit" });
11+
// Update the lockfile with the new versions of the packages
12+
execSync("pnpm install --no-frozen-lockfile", { stdio: "inherit" });

.github/utils/update-version.cjs

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

.github/workflows/changesets.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Handle Changesets
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
release:
10+
if: ${{ github.repository_owner == 'opennextjs' }}
11+
name: Handle Changesets
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout Repo
15+
uses: actions/checkout@v4
16+
with:
17+
# See https://github.com/changesets/action/issues/187
18+
token: ${{ secrets.GH_ACCESS_TOKEN }}
19+
fetch-depth: 0
20+
21+
- name: Install Dependencies
22+
uses: ./.github/actions/install-dependencies
23+
24+
- name: Build Cloudflare package
25+
run: pnpm run build
26+
27+
- name: Create Version PR or Publish to NPM
28+
id: changesets
29+
uses: changesets/action@v1
30+
with:
31+
version: node .github/utils/custom-changeset-version.mjs
32+
publish: pnpm exec changeset publish
33+
env:
34+
GITHUB_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }}
35+
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
36+
NODE_ENV: "production"

.github/workflows/playwright.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ jobs:
2020
- name: Install Playwright
2121
run: pnpm run install-playwright
2222

23+
- name: Build the tool
24+
run: pnpm build
25+
2326
- name: Build all workers
2427
run: pnpm -r build:worker
2528

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"version": "0.0.0.0",
44
"private": true,
55
"devDependencies": {
6+
"@changesets/cli": "^2.27.9",
67
"@playwright/test": "1.47.0",
78
"pkg-pr-new": "^0.0.29",
89
"prettier": "3.3.3"
@@ -16,9 +17,9 @@
1617
"test": "pnpm -r test",
1718
"code:checks": "pnpm prettier:check && pnpm lint:check && pnpm ts:check",
1819
"code:fixes": "pnpm prettier:fix && pnpm lint:fix",
19-
"postinstall": "pnpm --filter cloudflare build",
2020
"install-playwright": "playwright install --with-deps",
21-
"e2e": "pnpm -r e2e",
22-
"e2e:dev": "pnpm -r e2e:dev"
21+
"build": "pnpm --filter cloudflare build",
22+
"e2e": "pnpm build && pnpm -r e2e",
23+
"e2e:dev": "pnpm build && pnpm -r e2e:dev"
2324
}
2425
}

0 commit comments

Comments
 (0)