Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
91 changes: 91 additions & 0 deletions .github/workflows/stable_obsidian_release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: Stable Obsidian Release
on:
workflow_dispatch:
inputs:
version:
description: "Stable version to release, e.g. 1.6.0. Must match an existing Linear release version."
required: true
type: string

permissions:
contents: write

env:
OBSIDIAN_PLUGIN_REPO_TOKEN: ${{ secrets.OBSIDIAN_PLUGIN_REPO_TOKEN }}
SUPABASE_USE_DB: production
SUPABASE_URL: ${{ secrets.SUPABASE_URL }}
SUPABASE_PUBLISHABLE_KEY: ${{ secrets.SUPABASE_PUBLISHABLE_KEY }}

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v6
with:
fetch-depth: 0

- name: Validate version format
run: |
if ! [[ "${{ inputs.version }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "::error::Version '${{ inputs.version }}' is not a valid stable version (expected x.y.z)"
exit 1
fi

- name: Install pnpm
uses: pnpm/action-setup@v6
with:
version: 10.15.1
run_install: false

- name: Setup Node.js environment
uses: actions/setup-node@v6
with:
node-version: "22"
cache: "pnpm"

- name: Install Dependencies
run: pnpm install --frozen-lockfile

- name: Guard against re-releasing an already-shipped version
run: |
CURRENT_VERSION=$(node -p "require('./apps/obsidian/package.json').version")
CURRENT_BASE="${CURRENT_VERSION%%-*}"
INPUT_VERSION="${{ inputs.version }}"
HIGHEST=$(printf '%s\n%s\n' "$CURRENT_BASE" "$INPUT_VERSION" | sort -V | tail -n1)
if [ "$HIGHEST" != "$INPUT_VERSION" ]; then
echo "::error::Requested version $INPUT_VERSION is behind the current version $CURRENT_VERSION."
exit 1
fi
if [ "$CURRENT_BASE" == "$INPUT_VERSION" ] && [[ "$CURRENT_VERSION" != *-beta.* ]]; then
echo "::error::Version $INPUT_VERSION has already been released (current version is $CURRENT_VERSION)."
exit 1
fi
Comment thread
trangdoan982 marked this conversation as resolved.
Outdated

- name: Publish stable release
run: cd apps/obsidian && npx tsx scripts/publish.ts --version ${{ inputs.version }}
Comment thread
trangdoan982 marked this conversation as resolved.
Outdated

- name: Commit version bump
run: |
if ! git diff --quiet -- apps/obsidian/package.json apps/obsidian/manifest.json; then
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add apps/obsidian/package.json apps/obsidian/manifest.json
git commit -m "chore: release obsidian ${{ inputs.version }} [skip ci]"
git push
fi

- name: Sync Linear release
uses: linear/linear-release-action@v0
with:
access_key: ${{ secrets.LINEAR_RELEASES_ACCESS_KEY }}
Comment thread
trangdoan982 marked this conversation as resolved.
Outdated
command: sync
version: ${{ inputs.version }}
include_paths: "apps/obsidian/**,packages/database/**,packages/utils/**"

- name: Complete Linear release
uses: linear/linear-release-action@v0
with:
access_key: ${{ secrets.LINEAR_RELEASES_ACCESS_KEY }}
command: complete
version: ${{ inputs.version }}
10 changes: 10 additions & 0 deletions apps/obsidian/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,3 +141,13 @@ For more information about Discourse Graphs, check out [our website](https://dis
1. Join our growing community of academics, researchers, and thinkers on [Slack 💬](https://join.slack.com/t/discoursegraphs/shared_invite/zt-37xklatti-cpEjgPQC0YyKYQWPNgAkEg)
2. Are you a lab or researcher interested in piloting the plugin with some guidance from the team? Send us [an email](mailto:discoursegraphs@homeworld.bio) or DM on Slack!
3. Discourse Graphs is [open source](https://en.wikipedia.org/wiki/Open_source) and open to contributions. If you have an idea for an improvement or identify a bug open an issue here on the repo to start the conversation.

# Release process

To ship an official stable release:

1. Merge a PR to `main` that bumps the version in `apps/obsidian/package.json` and `apps/obsidian/manifest.json` to the target stable version, e.g. `1.6.0`.
Comment thread
trangdoan982 marked this conversation as resolved.
Outdated
2. Make sure a Linear release with that exact version already exists.
3. From the Actions tab, manually run **Stable Obsidian Release** (`.github/workflows/stable_obsidian_release.yaml`) with the `version` input set to the same version.

That single run publishes the stable GitHub release, pushes it to the mirror repo, and syncs and completes the matching Linear release.
2 changes: 1 addition & 1 deletion apps/obsidian/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "@discourse-graph/obsidian",
"name": "Discourse Graph",
"version": "0.1.0",
"version": "1.5.1",
"minAppVersion": "1.7.0",
"description": "Add semantic structure to your notes with the Discourse Graph protocol.",
"author": "Discourse Graphs",
Expand Down
4 changes: 2 additions & 2 deletions apps/obsidian/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@discourse-graphs/obsidian",
"version": "0.1.0",
"version": "1.5.1",
"description": "Discourse Graph Plugin for obsidian.md",
"main": "dist/main.js",
"private": true,
Expand All @@ -9,7 +9,7 @@
"build": "tsx scripts/build.ts",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"publish": "tsx scripts/publish.ts --version 0.1.0",
"publish": "tsx scripts/publish.ts",
"check-types": "tsc --noEmit --skipLibCheck"
},
"keywords": [],
Expand Down
18 changes: 18 additions & 0 deletions apps/obsidian/scripts/publish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,23 @@ const sanitizePackageJsonForMirror = (tempDir: string): void => {
}
};

const updateLocalVersion = (obsidianDir: string, version: string): void => {
const packageJsonPath = path.join(obsidianDir, "package.json");
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf8"));
packageJson.version = version;
fs.writeFileSync(
packageJsonPath,
JSON.stringify(packageJson, null, 2) + "\n",
);

const manifestPath = path.join(obsidianDir, "manifest.json");
const manifest = JSON.parse(fs.readFileSync(manifestPath, "utf8"));
manifest.version = version;
fs.writeFileSync(manifestPath, JSON.stringify(manifest, null, 2) + "\n");

log(`Updated local package.json and manifest.json to version ${version}`);
};

const updateMainBranch = async (
tempDir: string,
version: string,
Expand Down Expand Up @@ -710,6 +727,7 @@ const publish = async (config: PublishConfig): Promise<void> => {
if (isExternal) {
updateManifest(tempDir, version);
await updateMainBranch(tempDir, version);
updateLocalVersion(obsidianDir, version);
} else {
log("Skipping main branch update for internal or pre-release");
}
Expand Down