Skip to content

Commit a4eb7be

Browse files
committed
Merge branch 'feat/version-ci'
2 parents 4fc8a28 + a6d3026 commit a4eb7be

9 files changed

Lines changed: 188 additions & 248 deletions

File tree

.changeset/config.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
{
22
"$schema": "https://unpkg.com/@changesets/config@3.0.5/schema.json",
3-
"changelog": "@changesets/cli/changelog",
3+
"changelog": ["@changesets/changelog-github", { "repo": "HugoRCD/shelve" }],
44
"commit": false,
55
"fixed": [],
66
"linked": [],
77
"access": "public",
88
"baseBranch": "main",
99
"updateInternalDependencies": "patch",
10-
"ignore": []
10+
"ignore": [],
11+
"___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH": {
12+
"onlyUpdatePeerDependentsWhenOutOfRange": true
13+
}
1114
}

.github/workflows/release.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
9+
concurrency: ${{ github.workflow }}-${{ github.ref }}
10+
11+
permissions:
12+
contents: write
13+
pull-requests: write
14+
id-token: write
15+
16+
jobs:
17+
release:
18+
runs-on: ubuntu-latest
19+
timeout-minutes: 20
20+
steps:
21+
- uses: actions/checkout@v6
22+
23+
- uses: actions/setup-node@v6
24+
with:
25+
node-version: "22"
26+
registry-url: "https://registry.npmjs.org"
27+
28+
- uses: pnpm/action-setup@v2
29+
with:
30+
version: latest
31+
32+
- name: Install dependencies
33+
run: pnpm install --frozen-lockfile
34+
35+
- name: Create Release PR or Publish
36+
id: changesets
37+
uses: changesets/action@v1
38+
with:
39+
title: "chore(repo): version packages"
40+
version: pnpm run version
41+
publish: pnpm run release
42+
createGithubReleases: false
43+
env:
44+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
45+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
46+
NPM_CONFIG_PROVENANCE: true
47+
48+
- name: Push tags
49+
if: steps.changesets.outputs.published == 'true'
50+
run: git push --tags
51+
52+
- name: Create GitHub releases (CLI)
53+
if: steps.changesets.outputs.published == 'true'
54+
run: |
55+
for pkg in $(echo '${{ steps.changesets.outputs.publishedPackages }}' | jq -r '.[] | .name + "@" + .version'); do
56+
tag="$pkg"
57+
if gh release view "$tag" > /dev/null 2>&1; then
58+
echo "Release $tag already exists, skipping"
59+
else
60+
gh release create "$tag" --draft --generate-notes --title "$tag"
61+
fi
62+
done
63+
env:
64+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
65+
66+
- name: Create GitHub release (App)
67+
if: steps.changesets.outputs.hasChangesets == 'false'
68+
run: |
69+
APP_VERSION=$(node -p "require('./apps/shelve/package.json').version")
70+
TAG="v${APP_VERSION}"
71+
if gh release view "$TAG" > /dev/null 2>&1; then
72+
echo "Release $TAG already exists, skipping"
73+
else
74+
gh release create "$TAG" --draft --generate-notes --title "Shelve $TAG"
75+
fi
76+
env:
77+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

AGENTS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@ Shelve is an open-source secrets management platform (web apps + CLI) built as a
66
- Non-standard build/typecheck commands:
77
`pnpm build` runs `turbo run build`.
88
`pnpm typecheck` runs `turbo run typecheck`.
9+
- Every feature, fix, or notable change **must** include a changeset (`pnpm changeset`). See [Changesets](docs/agents/changesets.md).
910

1011
More details (progressive disclosure):
1112
- [Monorepo and layout](docs/agents/monorepo.md)
1213
- [Commands and workflows](docs/agents/commands.md)
14+
- [Changesets](docs/agents/changesets.md)
1315
- [Tech stack](docs/agents/tech-stack.md)
1416
- [NuxtHub usage](docs/agents/nuxthub.md)
1517
- [Build env and outputs](docs/agents/build-env.md)

apps/base/nuxt.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { createResolver } from 'nuxt/kit'
2-
import pkg from '../../package.json'
2+
import pkg from '../shelve/package.json'
33

44
const { resolve } = createResolver(import.meta.url)
55

apps/shelve/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"name": "@shelve/app",
3+
"version": "2.3.3",
34
"description": "Shelve is a project management tool for developers teams",
45
"private": true,
56
"type": "module",

docs/agents/changesets.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Changesets
2+
3+
Shelve uses [Changesets](https://github.com/changesets/changesets) for versioning and changelog generation.
4+
5+
## When to add a changeset
6+
7+
Every feature, fix, or notable change **must** include a changeset. Run `pnpm changeset` from the repo root and select the affected packages:
8+
9+
- `@shelve/app` — for changes to the main Shelve application.
10+
- `@shelve/cli` — for changes to the CLI (published to npm).
11+
12+
Choose the semver bump type (`patch`, `minor`, `major`) and write a short summary of the change.
13+
14+
## How it works
15+
16+
1. `pnpm changeset` creates a markdown file in `.changeset/` describing the change.
17+
2. On push to `main`, the `release.yml` GitHub Action detects pending changesets and opens a **"Version packages"** PR that bumps versions and updates changelogs.
18+
3. When that PR is merged, the action publishes `@shelve/cli` to npm (if bumped) and creates draft GitHub releases.
19+
20+
## Scripts
21+
22+
- `pnpm changeset` — create a new changeset.
23+
- `pnpm version` — apply pending changesets (bump versions, update changelogs). Used by CI.
24+
- `pnpm release` — build the CLI and publish to npm. Used by CI.
25+
26+
## What not to do
27+
28+
- Do not manually edit version fields in `package.json` — let changesets handle it.
29+
- Do not skip the changeset for user-facing changes; CI will hold the release PR until one is added.

docs/agents/commands.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,11 @@
2727
- `pnpm lint:fix` runs `turbo run lint:fix`.
2828
- `pnpm typecheck` runs `turbo run typecheck`.
2929
- `pnpm test` runs `turbo run test`.
30-
- `pnpm release` runs `turbo run release` then `changeset`.
30+
31+
## Release
32+
33+
- `pnpm changeset` creates a new changeset (required for every feature/fix).
34+
- `pnpm version` applies pending changesets (bumps versions, updates changelogs). Used by CI.
35+
- `pnpm release` builds the CLI and publishes to npm. Used by CI.
36+
37+
See [Changesets](changesets.md) for the full workflow.

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
"lint": "turbo run lint",
1212
"lint:fix": "turbo run lint:fix",
1313
"typecheck": "turbo run typecheck",
14-
"release": "turbo run release && changeset",
14+
"changeset": "changeset",
15+
"version": "changeset version",
16+
"release": "pnpm run build:cli && changeset publish",
1517
"build:app": "turbo run build --filter=@shelve/app",
1618
"build:lp": "turbo run build --filter=@shelve/lp",
1719
"build:vault": "turbo run build --filter=@shelve/vault",
@@ -26,6 +28,7 @@
2628
"db:migrate": "pnpm --filter @shelve/app db:migrate"
2729
},
2830
"devDependencies": {
31+
"@changesets/changelog-github": "^0.6.0",
2932
"@changesets/cli": "^2.30.0",
3033
"@hrcd/eslint-config": "^3.0.3",
3134
"@shelve/cli": "workspace:*",

0 commit comments

Comments
 (0)