Skip to content

Commit ce8a281

Browse files
Changesets implementation (#66)
* ci: consolidate "install dependencies" into an action * ci: implement changesets * Update contributor docs * ci: first deployment via changesets * fixups * fix typo
1 parent 57c450e commit ce8a281

File tree

14 files changed

+812
-109
lines changed

14 files changed

+812
-109
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+
}

.changeset/perfect-eyes-hug.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@opennextjs/cloudflare": patch
3+
---
4+
5+
ci: first deployment via changesets
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: "Install Dependencies"
2+
description: "Install dependencies, fetching from cache when possible"
3+
4+
runs:
5+
using: "composite"
6+
steps:
7+
- name: Install pnpm
8+
uses: pnpm/action-setup@v4
9+
with:
10+
version: 9
11+
12+
- name: Install Node.js
13+
uses: actions/setup-node@v4
14+
with:
15+
node-version: 20.18.0
16+
cache: "pnpm"
17+
registry-url: "https://registry.npmjs.org"
18+
19+
- name: Install NPM Dependencies
20+
shell: bash
21+
run: pnpm install --frozen-lockfile
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 `pnpm 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/checks.yml

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,8 @@ jobs:
1818
- name: Check out code
1919
uses: actions/checkout@v4
2020

21-
- name: Setup pnpm
22-
uses: pnpm/action-setup@v4
23-
with:
24-
version: 9
25-
26-
- name: Setup Node.js environment
27-
uses: actions/setup-node@v4
28-
with:
29-
node-version: 20
30-
cache: "pnpm"
31-
32-
- name: Install dependencies
33-
run: pnpm install --frozen-lockfile
21+
- name: Install Dependencies
22+
uses: ./.github/actions/install-dependencies
3423

3524
- name: ${{ matrix.script }}
3625
run: pnpm run ${{ matrix.script }}

.github/workflows/playwright.yml

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,14 @@ jobs:
1414
- name: Check out code
1515
uses: actions/checkout@v4
1616

17-
- name: Setup pnpm
18-
uses: pnpm/action-setup@v4
19-
with:
20-
version: 9
21-
22-
- name: Setup Node.js environment
23-
uses: actions/setup-node@v4
24-
with:
25-
node-version: 20
26-
cache: "pnpm"
27-
28-
- name: Install dependencies
29-
run: |
30-
pnpm install --frozen-lockfile
31-
pnpm run install-playwright
17+
- name: Install Dependencies
18+
uses: ./.github/actions/install-dependencies
19+
20+
- name: Install Playwright
21+
run: pnpm run install-playwright
22+
23+
- name: Build the tool
24+
run: pnpm build
3225

3326
- name: Build all workers
3427
run: pnpm -r build:worker

.github/workflows/prereleases.yml

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,8 @@ jobs:
1414
with:
1515
fetch-depth: 0
1616

17-
- name: Install pnpm
18-
uses: pnpm/action-setup@v4
19-
with:
20-
version: 9.10.0
21-
22-
- name: Install Node.js 20
23-
uses: actions/setup-node@v4
24-
with:
25-
node-version: 20
26-
cache: "pnpm"
27-
registry-url: "https://registry.npmjs.org"
28-
2917
- name: Install Dependencies
30-
run: pnpm i --frozen-lockfile
18+
uses: ./.github/actions/install-dependencies
3119

3220
- name: Build
3321
run: pnpm -F cloudflare run build

0 commit comments

Comments
 (0)