Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1 +1,21 @@
# Required: GitHub OAuth App client id (baked into the app at build time).
GITHUB_CLIENT_ID=

# --- Optional: macOS code signing / notarization (leave blank = unsigned build) ---
# CSC_LINK: path to a .p12, or a base64-encoded .p12 string
# CSC_LINK=
# CSC_KEY_PASSWORD=
# To also notarize, set the three below and enable `mac.notarize` (see CONTRIBUTING.md).
# APPLE_ID=
# APPLE_APP_SPECIFIC_PASSWORD=
# APPLE_TEAM_ID=

# --- Optional: Cloudflare R2 (public download + update manifest) ---
# R2_ACCOUNT_ID / R2_BUCKET + the access keys let the publish workflow upload installers.
# R2_PUBLIC_BASE_URL is the public URL the files are served from; setting it also makes the
# build emit latest*.yml (the update manifest a future in-app "check for updates" can read).
# R2_ACCOUNT_ID=
# R2_BUCKET=
# R2_PUBLIC_BASE_URL=
# R2_ACCESS_KEY_ID=
# R2_SECRET_ACCESS_KEY=
49 changes: 49 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Build

# Test-packages the app across platforms/architectures to catch packaging breakage.
# Produces unsigned artifacts; does not create a release.
on:
workflow_dispatch:
pull_request:
branches: [main]
paths-ignore:
- '**/*.md'
- 'docs/**'

concurrency:
group: build-${{ github.ref }}
cancel-in-progress: true

jobs:
package:
strategy:
fail-fast: false
matrix:
include:
- os: macos-latest # builds both arm64 (Apple Silicon) and x64 (Intel)
script: package:mac
- os: windows-latest
script: package:win
- os: ubuntu-latest
script: package:linux
runs-on: ${{ matrix.os }}
env:
GITHUB_CLIENT_ID: ${{ vars.GITHUB_CLIENT_ID }}
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: pnpm
- run: pnpm install --frozen-lockfile
- name: Download Electron runtime
run: pnpm --filter @oh-my-github/client exec install-electron
- name: Package
run: pnpm ${{ matrix.script }}
- uses: actions/upload-artifact@v4
with:
name: build-${{ matrix.os }}
path: packages/client/release/**
retention-days: 7
if-no-files-found: error
31 changes: 31 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: CI

on:
push:
branches: [main]
pull_request:

concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true

jobs:
verify:
runs-on: ubuntu-latest
env:
# Typecheck + tests don't need the Electron runtime; skip the binary download.
ELECTRON_SKIP_BINARY_DOWNLOAD: '1'
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: pnpm
- run: pnpm install --frozen-lockfile
- name: Typecheck
run: pnpm -r typecheck
- name: Test
run: pnpm -r test
# Add a dedicated lint step here when a real linter is introduced
# (today `lint` aliases typecheck, already covered above).
103 changes: 103 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
name: Publish

# Triggered by pushing a version tag (e.g. v0.2.0):
# 1. package the app on every platform
# 2. generate a changelog + create the GitHub Release (changelogithub)
# 3. attach installers to the release and upload them to Cloudflare R2 (public download)
on:
push:
tags: ['v*']

permissions:
contents: write

jobs:
package:
strategy:
fail-fast: false
matrix:
include:
- os: macos-latest # builds both arm64 (Apple Silicon) and x64 (Intel)
script: package:mac
- os: windows-latest
script: package:win
- os: ubuntu-latest
script: package:linux
runs-on: ${{ matrix.os }}
env:
GITHUB_CLIENT_ID: ${{ vars.GITHUB_CLIENT_ID }}
# When set, the build also emits latest*.yml + app-update.yml (update manifest for R2).
R2_PUBLIC_BASE_URL: ${{ vars.R2_PUBLIC_BASE_URL }}
# Code signing (optional — empty = unsigned build).
CSC_LINK: ${{ secrets.CSC_LINK }}
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
APPLE_ID: ${{ vars.APPLE_ID }}
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }}
APPLE_TEAM_ID: ${{ vars.APPLE_TEAM_ID }}
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: pnpm
- run: pnpm install --frozen-lockfile
- name: Download Electron runtime
run: pnpm --filter @oh-my-github/client exec install-electron
- name: Package
run: pnpm ${{ matrix.script }}
- uses: actions/upload-artifact@v4
with:
name: release-${{ matrix.os }}
path: packages/client/release/**
retention-days: 7
if-no-files-found: error

release:
needs: package
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # changelogithub needs full history
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: pnpm
- uses: actions/download-artifact@v4
with:
path: artifacts
- name: Collect release files
run: |
mkdir -p out
find artifacts -type f \
\( -name '*.dmg' -o -name '*.zip' -o -name '*.exe' \
-o -name '*.AppImage' -o -name 'latest*.yml' -o -name '*.blockmap' \) \
-exec cp -f {} out/ \;
ls -la out
- name: Generate changelog and create GitHub Release
run: pnpm dlx changelogithub
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Attach installers to the GitHub Release
run: gh release upload "${GITHUB_REF_NAME}" out/* --clobber
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload to Cloudflare R2
if: ${{ vars.R2_BUCKET != '' }}
env:
R2_BUCKET: ${{ vars.R2_BUCKET }}
R2_ACCOUNT_ID: ${{ vars.R2_ACCOUNT_ID }}
AWS_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: auto
run: |
endpoint="https://${R2_ACCOUNT_ID}.r2.cloudflarestorage.com"
# Installers + blockmaps: immutable filenames, fine to cache.
aws s3 cp out/ "s3://${R2_BUCKET}/" --recursive \
--exclude 'latest*.yml' --endpoint-url "$endpoint"
# Update manifests must not be cached, or an update check would miss new releases.
aws s3 cp out/ "s3://${R2_BUCKET}/" --recursive \
--exclude '*' --include 'latest*.yml' \
--cache-control 'no-cache' --endpoint-url "$endpoint"
102 changes: 102 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
# Contributing

## Prerequisites

- **Node** `^20.19.0 || >=22.12.0`
- **pnpm** `11.7.0` (pinned via `packageManager`; `corepack enable` will provision it)

```sh
pnpm run env:setup # install deps + download the Electron runtime (uses the .npmrc mirror)
```

## Common commands

```sh
pnpm dev # run the Electron app in development
pnpm -r typecheck # typecheck every package (also aliased as `pnpm lint`)
pnpm -r test # run vitest across packages (api + client)
pnpm build # build all packages
pnpm package # build installers for the current OS (electron-builder)
pnpm package:mac # .dmg / .zip (arm64 + x64)
pnpm package:win # Windows NSIS .exe (x64)
pnpm package:linux # Linux AppImage (x64 + arm64)
```

Packaging runs through `packages/client/scripts/with-env.mjs`, which loads the monorepo-root
`.env` into the environment before invoking `electron-builder`. Values already present in the
environment (e.g. CI-provided ones) always win over `.env`.

## Environment variables

Copy `.env.example` to `.env` for local development. Only `GITHUB_CLIENT_ID` is required; the
rest are optional and used only for signed/published release builds.

| Variable | Required | Purpose | Local | GitHub Actions |
|---|---|---|---|---|
| `GITHUB_CLIENT_ID` | **yes** | GitHub OAuth App client id, baked into the app at build time | `.env` | **Variable** |
| `CSC_LINK` | no | Code-signing cert — `.p12` path or base64 string | `.env` | **Secret** |
| `CSC_KEY_PASSWORD` | no | Code-signing cert password | `.env` | **Secret** |
| `APPLE_ID` | no | Apple ID email (notarization) | `.env` | **Variable** |
| `APPLE_APP_SPECIFIC_PASSWORD` | no | Apple app-specific password (notarization) | `.env` | **Secret** |
| `APPLE_TEAM_ID` | no | Apple Developer Team ID (notarization) | `.env` | **Variable** |
| `R2_ACCOUNT_ID` | no | Cloudflare account id (R2 upload) | `.env` | **Variable** |
| `R2_BUCKET` | no | R2 bucket name (publish uploads here; also gates the R2 step) | `.env` | **Variable** |
| `R2_PUBLIC_BASE_URL` | no | Public URL the R2 files are served from; also triggers `latest*.yml` (update manifest) generation | `.env` | **Variable** |
| `R2_ACCESS_KEY_ID` | no | R2 S3 access key id | `.env` | **Secret** |
| `R2_SECRET_ACCESS_KEY` | no | R2 S3 secret access key | `.env` | **Secret** |
| `OH_MY_GITHUB_CDP_PORT` | no | Dev-only Chrome DevTools Protocol port (see README) | env | — |
| `HTTPS_PROXY` / `HTTP_PROXY` / `ALL_PROXY` | no | Dev network proxy (see README) | env | — |

> **Variable vs Secret:** non-sensitive values go in repo/Org **Variables** (`vars.*`),
> credentials go in **Secrets** (`secrets.*`). `GITHUB_TOKEN` is provided automatically.

## CI/CD

Three workflows under `.github/workflows/`:

| Workflow | Trigger | What it does |
|---|---|---|
| `ci.yml` | push to `main`, every PR | `pnpm -r typecheck` + `pnpm -r test` |
| `build.yml` | every PR to `main`, manual dispatch | Test-packages macOS / Windows / Linux and uploads the installers as artifacts (unsigned) |
| `publish.yml` | push of a `v*` tag | Packages all platforms → `changelogithub` generates the changelog and creates the GitHub Release → installers are attached to the release and uploaded to Cloudflare R2 |

### Cutting a release

```sh
# bump the version (root + packages/client package.json), commit, then:
git tag v0.2.0
git push origin v0.2.0
```

The tag push triggers `publish.yml`. Installers land on the GitHub Release and, when the R2
variables/secrets are configured, in the R2 bucket for public download.

## Distribution via Cloudflare R2

The repository is private, so GitHub Release assets are not publicly downloadable. The publish
workflow therefore also uploads installers to a **Cloudflare R2** bucket (S3-compatible, zero
egress fees). Make the bucket public via its `*.r2.dev` URL or a custom domain, set the `R2_*`
variables/secrets, and share `R2_PUBLIC_BASE_URL` as the download link. If the R2 variables are
absent the workflow simply skips the upload.

When `R2_PUBLIC_BASE_URL` is set, the build also emits the update manifest
(`latest.yml` / `latest-mac.yml` / `latest-linux.yml`) and bundles an `app-update.yml` pointing
at that URL. These are uploaded alongside the installers (manifests with `Cache-Control: no-cache`).
There is no in-app auto-updater yet — the manifest is published so a future manual "check for
updates" can read the latest version from R2.

## Code signing (optional)

Builds are unsigned by default. To sign:

- **macOS / Windows:** set `CSC_LINK` + `CSC_KEY_PASSWORD`. The build script auto-signs when a
cert is present (and stays unsigned otherwise).
- **macOS notarization:** additionally set `APPLE_ID`, `APPLE_APP_SPECIFIC_PASSWORD`,
`APPLE_TEAM_ID` and add `notarize: true` under `mac:` in
`packages/client/electron-builder.yml`.

## Commit & PR conventions

- Commit messages and PR titles follow **Conventional Commits**, in **English**
(`changelogithub` derives the release notes from them).
- See `AGENTS.md` for repository conventions and the frontend design language.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ project pins `electron_mirror` in `.npmrc` so Electron installs reliably in loca
installers are available through `pnpm package:mac` for `.dmg`/`.zip` and `pnpm package:win` for a
Windows NSIS `.exe` installer. Release artifacts are written under `packages/client/release/`.

See [`CONTRIBUTING.md`](CONTRIBUTING.md) for environment variables, the CI/CD workflows, how to
cut a release, and code-signing setup.

## Developer Debugging

The Electron renderer can expose a local Chrome DevTools Protocol endpoint in development builds.
Expand Down
7 changes: 6 additions & 1 deletion packages/client/electron-builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ npmRebuild: false

mac:
category: public.app-category.developer-tools
identity: null
# Signing is driven by env: with no CSC_LINK the build script sets
# CSC_IDENTITY_AUTO_DISCOVERY=false (unsigned, no keychain prompt); set CSC_LINK +
# CSC_KEY_PASSWORD to sign. See scripts/with-env.mjs and CONTRIBUTING.md.
target:
- target: dmg
arch:
Expand Down Expand Up @@ -43,6 +45,9 @@ nsis:

linux:
category: Development
# The scoped package name (@oh-my-github/client) is not a valid AppImage executable
# name, so set a clean one explicitly.
executableName: oh-my-github
target:
- target: AppImage
arch:
Expand Down
12 changes: 6 additions & 6 deletions packages/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
"scripts": {
"dev": "electron-vite dev",
"build": "electron-vite build",
"package": "pnpm run build && electron-builder",
"package:dir": "pnpm run build && electron-builder --dir",
"package:mac": "pnpm run build && electron-builder --mac",
"package:win": "pnpm run build && electron-builder --win --x64",
"package:win:arm64": "pnpm run build && electron-builder --win --arm64",
"package:linux": "pnpm run build && electron-builder --linux",
"package": "pnpm run build && node scripts/with-env.mjs electron-builder",
"package:dir": "pnpm run build && node scripts/with-env.mjs electron-builder --dir",
"package:mac": "pnpm run build && node scripts/with-env.mjs electron-builder --mac",
"package:win": "pnpm run build && node scripts/with-env.mjs electron-builder --win --x64",
"package:win:arm64": "pnpm run build && node scripts/with-env.mjs electron-builder --win --arm64",
"package:linux": "pnpm run build && node scripts/with-env.mjs electron-builder --linux",
"typecheck": "vue-tsc -p tsconfig.json --noEmit",
"test": "vitest run"
},
Expand Down
Loading
Loading