Skip to content

Open-source Grok Bot alternative for named AI teammates. Local-first desktop, web, and mobile clients with per-bot tools, instructions, and memory. Independent fork of T3 Code.

feat(ci): add release workflow_dispatch version tagging

Julius Marmingeae235f715589
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index dcf2933f6..fc65b22da 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -4,6 +4,12 @@ on:
push:
tags:
- "v*.*.*"
+ workflow_dispatch:
+ inputs:
+ version:
+ description: "Release version (for example 1.2.3 or v1.2.3)"
+ required: true
+ type: string
permissions:
contents: write
@@ -14,10 +20,33 @@ jobs:
name: Preflight
runs-on: ubuntu-24.04
outputs:
- version: ${{ steps.version.outputs.value }}
+ version: ${{ steps.release_meta.outputs.version }}
+ tag: ${{ steps.release_meta.outputs.tag }}
+ ref: ${{ steps.release_ref.outputs.value }}
steps:
- name: Checkout
uses: actions/checkout@v4
+ with:
+ fetch-depth: 0
+
+ - id: release_meta
+ name: Resolve release version
+ shell: bash
+ run: |
+ if [[ "${GITHUB_EVENT_NAME}" == "workflow_dispatch" ]]; then
+ raw="${{ github.event.inputs.version }}"
+ else
+ raw="${GITHUB_REF_NAME}"
+ fi
+
+ version="${raw#v}"
+ if [[ ! "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+([.-][0-9A-Za-z.-]+)?$ ]]; then
+ echo "Invalid release version: $raw" >&2
+ exit 1
+ fi
+
+ echo "version=$version" >> "$GITHUB_OUTPUT"
+ echo "tag=v$version" >> "$GITHUB_OUTPUT"
- name: Setup Bun
uses: oven-sh/setup-bun@v2
@@ -29,6 +58,65 @@ jobs:
with:
node-version-file: package.json
+ - name: Update version strings
+ if: github.event_name == 'workflow_dispatch'
+ env:
+ RELEASE_VERSION: ${{ steps.release_meta.outputs.version }}
+ run: |
+ node --input-type=module -e '
+ import { readFileSync, writeFileSync } from "node:fs";
+
+ const files = [
+ "apps/server/package.json",
+ "apps/desktop/package.json",
+ "apps/web/package.json",
+ "packages/contracts/package.json",
+ ];
+
+ for (const file of files) {
+ const packageJson = JSON.parse(readFileSync(file, "utf8"));
+ packageJson.version = process.env.RELEASE_VERSION;
+ writeFileSync(file, `${JSON.stringify(packageJson, null, 2)}\n`);
+ }
+ '
+
+ - name: Refresh lockfile
+ if: github.event_name == 'workflow_dispatch'
+ run: bun install
+
+ - name: Commit and push release version + tag
+ if: github.event_name == 'workflow_dispatch'
+ shell: bash
+ env:
+ RELEASE_TAG: ${{ steps.release_meta.outputs.tag }}
+ run: |
+ if git ls-remote --exit-code --tags origin "$RELEASE_TAG" >/dev/null 2>&1; then
+ echo "Tag $RELEASE_TAG already exists on origin." >&2
+ exit 1
+ fi
+
+ git config user.name "github-actions[bot]"
+ git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
+
+ if ! git diff --quiet -- apps/server/package.json apps/desktop/package.json apps/web/package.json packages/contracts/package.json bun.lock; then
+ git add apps/server/package.json apps/desktop/package.json apps/web/package.json packages/contracts/package.json bun.lock
+ git commit -m "chore(release): prepare $RELEASE_TAG" -m "Co-authored-by: codex <[email protected]>"
+ fi
+
+ git tag "$RELEASE_TAG"
+ git push origin "HEAD:${GITHUB_REF_NAME}"
+ git push origin "refs/tags/$RELEASE_TAG"
+
+ - id: release_ref
+ name: Resolve source ref
+ shell: bash
+ run: |
+ if [[ "${GITHUB_EVENT_NAME}" == "workflow_dispatch" ]]; then
+ echo "value=refs/tags/${{ steps.release_meta.outputs.tag }}" >> "$GITHUB_OUTPUT"
+ else
+ echo "value=${GITHUB_SHA}" >> "$GITHUB_OUTPUT"
+ fi
+
- name: Install dependencies
run: bun install --frozen-lockfile
@@ -41,10 +129,6 @@ jobs:
- name: Test
run: bun run test
- - id: version
- name: Resolve release version
- run: echo "value=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"
-
build:
name: Build ${{ matrix.label }}
needs: preflight
@@ -76,6 +160,9 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
+ with:
+ ref: ${{ needs.preflight.outputs.ref }}
+ fetch-depth: 0
- name: Setup Bun
uses: oven-sh/setup-bun@v2
@@ -215,7 +302,7 @@ jobs:
- name: Publish release
uses: softprops/action-gh-release@v2
with:
- tag_name: ${{ github.ref_name }}
+ tag_name: ${{ needs.preflight.outputs.tag }}
name: T3 Code v${{ needs.preflight.outputs.version }}
generate_release_notes: true
files: release-assets/*