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
94 changes: 94 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
name: Release

on:
push:
branches:
- main
paths-ignore:
- Formula/ais.rb
workflow_dispatch:
inputs:
publish_test:
description: Publish a prerelease package to npm "test" tag
required: false
default: true
type: boolean

permissions:
contents: write
pull-requests: write

jobs:
release:
runs-on: ubuntu-latest
outputs:
published: ${{ steps.changesets.outputs.published }}
published_version: ${{ steps.version.outputs.version }}
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup pnpm
uses: pnpm/action-setup@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm
registry-url: https://registry.npmjs.org

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

- name: Run tests
run: pnpm test -- --run

- name: Build
run: pnpm build

- name: Set unique prerelease version for test publish
id: test_version
if: github.event_name == 'workflow_dispatch' && inputs.publish_test
run: |
VERSION=$(node -e 'const fs=require("fs");const pkg=JSON.parse(fs.readFileSync("package.json","utf8"));const [major,minor,patch]=pkg.version.split("-")[0].split(".").map(Number);console.log([major,minor,patch+1].join(".")+"-test."+process.env.GITHUB_RUN_NUMBER+"."+process.env.GITHUB_RUN_ATTEMPT);')
npm version "$VERSION" --no-git-tag-version
echo "version=$VERSION" >> "$GITHUB_OUTPUT"

- name: Publish npm test tag
if: github.event_name == 'workflow_dispatch' && inputs.publish_test
run: pnpm publish --tag test --no-git-checks
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Create release PR or publish
id: changesets
if: github.event_name != 'workflow_dispatch' || inputs.publish_test != true
uses: changesets/action@v1
with:
version: pnpm changeset version
publish: pnpm changeset publish
title: "chore: release versions"
commit: "chore: release versions"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Resolve published version
id: version
if: steps.changesets.outputs.published == 'true'
run: |
VERSION=$(node -p "require('./package.json').version")
echo "version=$VERSION" >> "$GITHUB_OUTPUT"

- name: Summary for test publish
if: github.event_name == 'workflow_dispatch' && inputs.publish_test
run: echo "Published ai-rules-sync@${{ steps.test_version.outputs.version }} to npm tag 'test'."

update-homebrew:
needs: release
if: needs.release.outputs.published == 'true'
uses: ./.github/workflows/update-homebrew.yml
with:
version: ${{ needs.release.outputs.published_version }}
63 changes: 29 additions & 34 deletions .github/workflows/update-homebrew.yml
Original file line number Diff line number Diff line change
@@ -1,53 +1,48 @@
name: Update Homebrew Tap

on:
workflow_run:
workflows: ["Release"]
types:
- completed
workflow_call:
inputs:
version:
description: Release version to publish (without v prefix)
required: true
type: string
workflow_dispatch:
inputs:
version:
description: Release version to publish (without v prefix)
required: true
type: string

permissions:
contents: write

jobs:
update-tap:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
steps:
- name: Get new version
id: version
run: |
VERSION=$(npm view ai-rules-sync version)
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
- name: Checkout repository
uses: actions/checkout@v4

- name: Compute tarball SHA256
id: sha256
env:
VERSION: ${{ inputs.version }}
run: |
URL="https://registry.npmjs.org/ai-rules-sync/-/ai-rules-sync-${{ steps.version.outputs.version }}.tgz"
URL="https://registry.npmjs.org/ai-rules-sync/-/ai-rules-sync-${VERSION}.tgz"
SHA=$(curl -fsSL "$URL" | sha256sum | awk '{print $1}')
echo "sha256=$SHA" >> "$GITHUB_OUTPUT"

- name: Checkout Tap repository
uses: actions/checkout@v4
with:
repository: lbb00/homebrew-ai-rules-sync
token: ${{ secrets.HOMEBREW_TAP_TOKEN }}
path: tap

- name: Update Formula
env:
VERSION: ${{ inputs.version }}
SHA: ${{ steps.sha256.outputs.sha256 }}
run: |
VERSION="${{ steps.version.outputs.version }}"
SHA="${{ steps.sha256.outputs.sha256 }}"
sed -i "s|url \"https://registry.npmjs.org/ai-rules-sync/-/ai-rules-sync-.*\.tgz\"|url \"https://registry.npmjs.org/ai-rules-sync/-/ai-rules-sync-${VERSION}.tgz\"|" tap/Formula/ais.rb
sed -i "s|sha256 \".*\"|sha256 \"${SHA}\"|" tap/Formula/ais.rb
sed -i "s|url \"https://registry.npmjs.org/ai-rules-sync/-/ai-rules-sync-.*\\.tgz\"|url \"https://registry.npmjs.org/ai-rules-sync/-/ai-rules-sync-${VERSION}.tgz\"|" Formula/ais.rb
sed -i "s|sha256 \".*\"|sha256 \"${SHA}\"|" Formula/ais.rb

- name: Create Pull Request
uses: peter-evans/create-pull-request@v7
- name: Commit formula update
uses: stefanzweifel/git-auto-commit-action@v5
with:
token: ${{ secrets.HOMEBREW_TAP_TOKEN }}
path: tap
commit-message: "chore: update ais to v${{ steps.version.outputs.version }}"
title: "chore: update ais to v${{ steps.version.outputs.version }}"
body: |
Automated update for ai-rules-sync v${{ steps.version.outputs.version }}.

- url: `https://registry.npmjs.org/ai-rules-sync/-/ai-rules-sync-${{ steps.version.outputs.version }}.tgz`
- sha256: `${{ steps.sha256.outputs.sha256 }}`
branch: "update-ais-${{ steps.version.outputs.version }}"
commit_message: "chore(homebrew): update formula to v${{ inputs.version }}"
file_pattern: Formula/ais.rb
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# ai-rules-sync

## 0.6.0

### Minor Changes

- Add Windsurf, Cline, user-level sync, and Cursor AI 9384 support

- Add Windsurf and Cline AI adapter support (rules and skills)
- Add user-level sync support (`--user` flag) for all tools, syncing to home directory
- Add user config management via `~/.config/ai-rules-sync/user.json`
- Add Cursor AI 9384 support
- Add Homebrew tap support for `brew install ais`

## 0.5.0

### Minor Changes
Expand Down
Loading