Skip to content

Commit

Permalink
GitHub Release on push to main (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikecann authored Jan 30, 2025
1 parent 6b4eab3 commit 71a2e92
Show file tree
Hide file tree
Showing 5 changed files with 106 additions and 2 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Create Release

on:
push:
branches:
- main

permissions:
contents: write
pull-requests: read

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pdm
pdm install
- name: Build Release Files
run: |
pdm run python build_release.py
- name: Create Release
id: create_release
uses: rymndhng/release-on-push-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
bump_version_scheme: minor
tag_prefix: v
release_name: "Release <RELEASE_VERSION>"

- name: Upload Release Assets
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
for file in dist/*; do
if [ -f "$file" ]; then
gh release upload "${{ steps.create_release.outputs.tag_name }}" "$file" --clobber
fi
done
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -182,4 +182,6 @@ evals/**/backend
__pycache__/
convex-local-backend

.pdm-python
.pdm-python

dist/
36 changes: 36 additions & 0 deletions build_release.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/usr/bin/env python3

import os
from runner.models.anthropic_codegen import build_release_rules as build_anthropic_rules
from runner.models.openai_codegen import build_release_rules as build_openai_rules

MDC_FRONTMATTER = """---
description: Guidelines and best practices for building Convex projects, including database schema design, queries, mutations, and real-world examples
globs: **/*.{ts,tsx,js,jsx}
---
"""

def main():
os.makedirs("dist", exist_ok=True)

# Generate rules (we could do more model-specific ones in the future)
# Using a very specific filename here to make it clear for AI usage what this is.

with open("dist/anthropic_convex_rules.txt", "w") as f:
f.write(build_anthropic_rules())

with open("dist/openai_convex_rules.txt", "w") as f:
f.write(build_openai_rules())

# Generate MDC files with frontmatter
with open("dist/anthropic_convex_rules.mdc", "w") as f:
f.write(MDC_FRONTMATTER)
f.write(build_anthropic_rules())

with open("dist/openai_convex_rules.mdc", "w") as f:
f.write(MDC_FRONTMATTER)
f.write(build_openai_rules())

if __name__ == "__main__":
main()
8 changes: 8 additions & 0 deletions runner/models/anthropic_codegen.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,4 +151,12 @@ def render_convex_guidelines(node: Union[GuidelineSection, Guideline], indentati
yield indentation + f"</{node.name}>\n"


# Used by the eval system
ANTHROPIC_CONVEX_GUIDELINES = "".join(render_convex_guidelines(CONVEX_GUIDELINES))

def build_release_rules() -> str:
return (
"".join(render_convex_guidelines(CONVEX_GUIDELINES)) +
"\n\n" +
"".join(render_examples())
)
9 changes: 8 additions & 1 deletion runner/models/openai_codegen.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,4 +175,11 @@ def render_guidelines(node: Union[GuidelineSection, Guideline], header="#"):
yield from render_guidelines(child, header + "#")
yield "\n"

OPENAI_CONVEX_GUIDELINES = "".join(render_guidelines(CONVEX_GUIDELINES))
# Used by the eval system
OPENAI_CONVEX_GUIDELINES = "".join(render_guidelines(CONVEX_GUIDELINES))

def build_release_rules() -> str:
return (
"".join(render_guidelines(CONVEX_GUIDELINES)) +
"".join(render_examples())
)

0 comments on commit 71a2e92

Please sign in to comment.