feat: add oh-my-opencode-slim sync support + CI/CD pipeline #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI & Release | |
| on: | |
| push: | |
| branches: | |
| - "**" | |
| pull_request: | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: ci-release-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| ci: | |
| name: Test, Typecheck, Build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Bun | |
| uses: oven-sh/setup-bun@v2 | |
| - name: Install dependencies | |
| run: bun install --frozen-lockfile | |
| - name: Run tests | |
| run: bun test | |
| - name: Run typecheck | |
| run: bun run typecheck | |
| - name: Build package | |
| run: bun run build | |
| publish: | |
| name: Publish to npm | |
| runs-on: ubuntu-latest | |
| needs: ci | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| permissions: | |
| contents: read | |
| id-token: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Bun | |
| uses: oven-sh/setup-bun@v2 | |
| - name: Setup Node for npm auth | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 24 | |
| - name: Ensure npm supports trusted publishing | |
| run: | | |
| npm install -g npm@latest | |
| npm --version | |
| - name: Install dependencies | |
| run: bun install --frozen-lockfile | |
| - name: Build package | |
| run: bun run build | |
| - name: Check if version already exists on npm | |
| id: version_check | |
| shell: bash | |
| run: | | |
| PACKAGE_NAME=$(node -p "require('./package.json').name") | |
| LOCAL_VERSION=$(node -p "require('./package.json').version") | |
| REMOTE_VERSION=$(npm view "$PACKAGE_NAME" version 2>/dev/null || true) | |
| echo "package_name=$PACKAGE_NAME" >> "$GITHUB_OUTPUT" | |
| echo "local_version=$LOCAL_VERSION" >> "$GITHUB_OUTPUT" | |
| echo "remote_version=$REMOTE_VERSION" >> "$GITHUB_OUTPUT" | |
| if [ "$LOCAL_VERSION" = "$REMOTE_VERSION" ]; then | |
| echo "should_publish=false" >> "$GITHUB_OUTPUT" | |
| echo "Version $LOCAL_VERSION already exists on npm for $PACKAGE_NAME. Skipping publish." | |
| else | |
| echo "should_publish=true" >> "$GITHUB_OUTPUT" | |
| echo "Publishing $PACKAGE_NAME@$LOCAL_VERSION (remote: ${REMOTE_VERSION:-none})." | |
| fi | |
| - name: Publish package | |
| if: steps.version_check.outputs.should_publish == 'true' | |
| run: npm publish --provenance --access public | |
| - name: Publish summary | |
| shell: bash | |
| run: | | |
| if [ "${{ steps.version_check.outputs.should_publish }}" = "true" ]; then | |
| echo "Published ${{ steps.version_check.outputs.package_name }}@${{ steps.version_check.outputs.local_version }}" | |
| else | |
| echo "Skipped publish: ${{ steps.version_check.outputs.package_name }}@${{ steps.version_check.outputs.local_version }} already exists" | |
| fi |