Skip to content

Commit d9aef26

Browse files
committed
feat: Try add changeset
1 parent c13c095 commit d9aef26

17 files changed

Lines changed: 413 additions & 25 deletions

File tree

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
"@memoneo/api": patch
3+
"@memoneo/auth": patch
4+
"@memoneo/shared": patch
5+
"@memoneo/app": patch
6+
"@memoneo/cli": patch
7+
---
8+
9+
Update TypeScript tooling and shared generated types.

.github/workflows/changesets.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Changesets
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
permissions:
9+
contents: write
10+
pull-requests: write
11+
12+
jobs:
13+
version:
14+
name: Version packages
15+
runs-on: ubuntu-latest
16+
if: github.actor != 'github-actions[bot]'
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
21+
- name: Set up Node
22+
uses: actions/setup-node@v4
23+
with:
24+
node-version: "24"
25+
26+
- name: Install Changesets
27+
run: npm install --no-package-lock --ignore-scripts @changesets/cli@^2.31.0
28+
29+
- name: Create version PR
30+
uses: changesets/action@v1
31+
with:
32+
version: npx changeset version
33+
title: Version packages
34+
commit: Version packages
35+
env:
36+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release-tags.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Release Tags
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
tag:
13+
name: Tag versioned packages
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 2
20+
21+
- name: Create package tags
22+
shell: bash
23+
run: |
24+
set -euo pipefail
25+
26+
git config user.name "github-actions[bot]"
27+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
28+
29+
declare -A packages=(
30+
["api"]="backend/api/package.json"
31+
["auth"]="backend/auth/package.json"
32+
["cli"]="frontend/apps/cli/package.json"
33+
["app"]="frontend/apps/app/package.json"
34+
["shared"]="frontend/packages/shared/package.json"
35+
)
36+
37+
for package in "${!packages[@]}"; do
38+
path="${packages[$package]}"
39+
if ! git diff --name-only HEAD^ HEAD -- "$path" | grep -q .; then
40+
continue
41+
fi
42+
43+
previous="$(git show "HEAD^:$path" | jq -r .version)"
44+
current="$(jq -r .version "$path")"
45+
if [ "$previous" = "$current" ]; then
46+
continue
47+
fi
48+
49+
tag="${package}@v${current}"
50+
if git ls-remote --tags origin "refs/tags/$tag" | grep -q "$tag"; then
51+
echo "Tag $tag already exists"
52+
continue
53+
fi
54+
55+
git tag "$tag"
56+
git push origin "$tag"
57+
done

.github/workflows/release.yml

Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "api@v*"
7+
- "auth@v*"
8+
- "cli@v*"
9+
- "app@v*"
10+
- "shared@v*"
11+
12+
permissions:
13+
contents: write
14+
15+
env:
16+
NODE_VERSION: "24"
17+
GO_VERSION: "1.23"
18+
GRADLE_USER_HOME: ${{ github.workspace }}/.gradle
19+
20+
jobs:
21+
release:
22+
name: Build package release
23+
runs-on: ubuntu-latest
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v4
27+
28+
- name: Resolve package
29+
shell: bash
30+
run: |
31+
set -euo pipefail
32+
tag="${GITHUB_REF_NAME}"
33+
package="${tag%%@v*}"
34+
version="${tag#*@v}"
35+
echo "PACKAGE=$package" >> "$GITHUB_ENV"
36+
echo "VERSION=$version" >> "$GITHUB_ENV"
37+
echo "TAG_SAFE=${tag//@/-}" >> "$GITHUB_ENV"
38+
39+
- name: Create artifact directory
40+
run: mkdir -p dist
41+
42+
- name: Set up Node
43+
if: env.PACKAGE == 'api' || env.PACKAGE == 'cli' || env.PACKAGE == 'app' || env.PACKAGE == 'shared'
44+
uses: actions/setup-node@v4
45+
with:
46+
node-version: ${{ env.NODE_VERSION }}
47+
48+
- name: Enable Corepack
49+
if: env.PACKAGE == 'api' || env.PACKAGE == 'cli' || env.PACKAGE == 'app' || env.PACKAGE == 'shared'
50+
run: corepack enable
51+
52+
- name: Set up Go
53+
if: env.PACKAGE == 'auth' || env.PACKAGE == 'shared' || env.PACKAGE == 'cli'
54+
uses: actions/setup-go@v5
55+
with:
56+
go-version: ${{ env.GO_VERSION }}
57+
cache-dependency-path: backend/auth/go.sum
58+
59+
- name: Set up Java
60+
if: env.PACKAGE == 'app'
61+
uses: actions/setup-java@v4
62+
with:
63+
distribution: temurin
64+
java-version: "17"
65+
66+
- name: Set up Android SDK
67+
if: env.PACKAGE == 'app'
68+
uses: android-actions/setup-android@v3
69+
70+
- name: Install API dependencies
71+
if: env.PACKAGE == 'api'
72+
working-directory: backend/api
73+
run: pnpm install --frozen-lockfile
74+
75+
- name: Test API
76+
if: env.PACKAGE == 'api'
77+
working-directory: backend/api
78+
run: pnpm test
79+
80+
- name: Typecheck API
81+
if: env.PACKAGE == 'api'
82+
working-directory: backend/api
83+
run: pnpm check
84+
85+
- name: Build API image
86+
if: env.PACKAGE == 'api'
87+
run: docker build --tag "memoneo-api:${TAG_SAFE}" backend/api
88+
89+
- name: Export API image
90+
if: env.PACKAGE == 'api'
91+
run: docker save "memoneo-api:${TAG_SAFE}" | gzip > "dist/memoneo-api-${TAG_SAFE}.tar.gz"
92+
93+
- name: Test auth service
94+
if: env.PACKAGE == 'auth'
95+
working-directory: backend/auth
96+
run: go test ./...
97+
98+
- name: Build auth service
99+
if: env.PACKAGE == 'auth'
100+
working-directory: backend/auth
101+
run: go build -o ../../dist/memoneo-auth .
102+
103+
- name: Build auth image
104+
if: env.PACKAGE == 'auth'
105+
run: docker build --file backend/auth/Dockerfile --tag "memoneo-auth:${TAG_SAFE}" backend
106+
107+
- name: Export auth image
108+
if: env.PACKAGE == 'auth'
109+
run: docker save "memoneo-auth:${TAG_SAFE}" | gzip > "dist/memoneo-auth-${TAG_SAFE}.tar.gz"
110+
111+
- name: Install frontend dependencies
112+
if: env.PACKAGE == 'cli' || env.PACKAGE == 'app' || env.PACKAGE == 'shared'
113+
working-directory: frontend
114+
run: pnpm install --frozen-lockfile
115+
116+
- name: Test frontend
117+
if: env.PACKAGE == 'cli' || env.PACKAGE == 'app' || env.PACKAGE == 'shared'
118+
working-directory: frontend
119+
run: pnpm test
120+
121+
- name: Typecheck frontend
122+
if: env.PACKAGE == 'cli' || env.PACKAGE == 'app' || env.PACKAGE == 'shared'
123+
working-directory: frontend
124+
run: pnpm typecheck
125+
126+
- name: Lint frontend
127+
if: env.PACKAGE == 'cli' || env.PACKAGE == 'app' || env.PACKAGE == 'shared'
128+
working-directory: frontend
129+
run: pnpm lint
130+
131+
- name: Build CLI
132+
if: env.PACKAGE == 'cli'
133+
working-directory: frontend
134+
run: pnpm build:cli
135+
136+
- name: Pack CLI
137+
if: env.PACKAGE == 'cli'
138+
working-directory: frontend
139+
run: pnpm --filter @memoneo/cli pack --pack-destination ../dist
140+
141+
- name: Build Android APK
142+
if: env.PACKAGE == 'app'
143+
working-directory: frontend/apps/app/android
144+
run: NODE_ENV=production ./gradlew assembleRelease
145+
146+
- name: Copy Android APK
147+
if: env.PACKAGE == 'app'
148+
run: cp frontend/apps/app/android/app/build/outputs/apk/release/app-release.apk "dist/memoneo-android-${TAG_SAFE}.apk"
149+
150+
- name: Build shared package
151+
if: env.PACKAGE == 'shared'
152+
working-directory: frontend
153+
run: pnpm --filter @memoneo/shared build
154+
155+
- name: Create shared package artifact
156+
if: env.PACKAGE == 'shared'
157+
working-directory: frontend
158+
run: pnpm --filter @memoneo/shared pack --pack-destination ../dist
159+
160+
- name: Create GitHub Release
161+
uses: softprops/action-gh-release@v2
162+
with:
163+
fail_on_unmatched_files: false
164+
generate_release_notes: true
165+
name: ${{ env.PACKAGE }} v${{ env.VERSION }}
166+
files: |
167+
dist/*

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
.DS_Store
22
*.7z
3-
config.json
3+
config.json
4+
.cache/
5+
node_modules/

backend/.dockerignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
**/.cache/
2+
**/node_modules/
3+
**/dist/
4+
auth/auth

backend/api/.changeset/tidy-typescript-tools.md

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

backend/api/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "api",
2+
"name": "@memoneo/api",
33
"version": "1.0.0",
44
"description": "",
55
"main": "index.js",
@@ -10,9 +10,9 @@
1010
"start": "tsx src/index.ts",
1111
"check": "tsc --noEmit",
1212
"test": "vitest run",
13-
"changeset": "changeset",
14-
"changeset:status": "changeset status",
15-
"changeset:version": "changeset version",
13+
"changeset": "cd ../.. && pnpm changeset",
14+
"changeset:status": "cd ../.. && pnpm changeset:status",
15+
"changeset:version": "cd ../.. && pnpm changeset:version",
1616
"openapi:download": "tsx src/scripts/download-openapi.ts",
1717
"db:generate": "drizzle-kit generate",
1818
"db:migrate": "drizzle-kit migrate"

backend/auth/package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"name": "@memoneo/auth",
3+
"version": "0.0.0",
4+
"private": true
5+
}

docs/release.md

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# Release Process
2+
3+
Releases are package based and versioned with Changesets.
4+
5+
## Add a release note
6+
7+
When a change should release one or more packages, create a changeset from the repo root:
8+
9+
```sh
10+
pnpm changeset
11+
```
12+
13+
Select the changed packages and bump type. The current releasable packages are:
14+
15+
- `@memoneo/api`: backend API Docker image.
16+
- `@memoneo/auth`: auth Go binary and Docker image.
17+
- `@memoneo/cli`: CLI package.
18+
- `@memoneo/app`: Android APK.
19+
- `@memoneo/shared`: shared frontend package.
20+
21+
## Automatic versioning
22+
23+
When changesets land on `main`, the `Changesets` workflow opens or updates a `Version packages` PR.
24+
25+
Merging that PR:
26+
27+
1. Updates package versions independently.
28+
2. Removes consumed changeset files.
29+
3. Triggers `Release Tags`, which creates package tags for changed package versions.
30+
4. Triggers `Release`, which builds and publishes GitHub Release artifacts for each package tag.
31+
32+
Package tags use this format:
33+
34+
```txt
35+
api@v0.1.0
36+
auth@v0.1.0
37+
cli@v0.1.0
38+
app@v0.1.0
39+
shared@v0.1.0
40+
```
41+
42+
## Release artifacts
43+
44+
- `api@vX.Y.Z`: `memoneo-api-api-vX.Y.Z.tar.gz`
45+
- `auth@vX.Y.Z`: `memoneo-auth-auth-vX.Y.Z.tar.gz`, `memoneo-auth`
46+
- `cli@vX.Y.Z`: packed CLI `.tgz`
47+
- `app@vX.Y.Z`: `memoneo-android-app-vX.Y.Z.apk`
48+
- `shared@vX.Y.Z`: packed shared package `.tgz`
49+
50+
## Local checks
51+
52+
Run these before merging releaseable work when possible:
53+
54+
```sh
55+
cd backend/api
56+
pnpm test
57+
pnpm check
58+
59+
cd ../auth
60+
go test ./...
61+
go build .
62+
63+
cd ../../frontend
64+
pnpm test
65+
pnpm typecheck
66+
pnpm lint
67+
pnpm build:cli
68+
pnpm build:app:android
69+
```
70+
71+
## Current limitations
72+
73+
- Android currently uses the checked-in debug signing configuration for release builds. Before distributing outside local testing, add release keystore secrets and wire them into `frontend/apps/app/android/app/build.gradle`.
74+
- Docker images are exported as release artifacts instead of being pushed to a registry. If you want deployable images, add GHCR publishing after the package-tag flow is working.
75+
- The API service is validated with tests and `tsc --noEmit`; it currently runs from TypeScript in the Docker image instead of producing a compiled JS artifact.

0 commit comments

Comments
 (0)