Skip to content

Commit

Permalink
ci: Re-introduce conditional publishing (#161)
Browse files Browse the repository at this point in the history
  • Loading branch information
johnjcsmith authored Nov 28, 2024
1 parent 8064df1 commit fee87be
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 32 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/check-package-changes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Check Package Changes

on:
pull_request:
branches:
- main
paths:
- 'sdk-*/**'
- 'cli/**'

jobs:
check-package-changes:
runs-on: ubuntu-latest
permissions:
pull-requests: read
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Check for multiple package changes
run: |
CHANGED_SDKS=$(git diff --name-only origin/${{ github.base_ref }} | grep -E '^sdk-[^/]+/' | cut -d'/' -f1 | sort -u)
CHANGED_CLI=$(git diff --name-only origin/${{ github.base_ref }} | grep -E '^cli/' | cut -d'/' -f1 | sort -u)
COUNT=$(echo "$CHANGED_SDKS $CHANGED_CLI" | grep -v '^$' | wc -l)
echo "Changed packages: $CHANGED_SDKS $CHANGED_CLI"
if [ "$COUNT" -gt 1 ]; then
echo "Error: Changes detected in multiple packages:"
echo "Please limit changes to one package at a time."
exit 1
fi
31 changes: 0 additions & 31 deletions .github/workflows/check-sdk-changes.yml

This file was deleted.

5 changes: 5 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ jobs:
publish-cli:
needs: check_changes
if: ${{ needs.check_changes.outputs.cli == 'true' }}
runs-on: ubuntu-latest
permissions:
contents: write
Expand Down Expand Up @@ -84,6 +85,7 @@ jobs:

publish-node:
needs: check_changes
if: ${{ needs.check_changes.outputs.sdk_node == 'true' }}
runs-on: ubuntu-latest
permissions:
contents: write
Expand Down Expand Up @@ -122,6 +124,7 @@ jobs:

publish-react:
needs: check_changes
if: ${{ needs.check_changes.outputs.sdk_react == 'true' }}
runs-on: ubuntu-latest
permissions:
contents: write
Expand Down Expand Up @@ -160,6 +163,7 @@ jobs:

publish-dotnet:
needs: check_changes
if: ${{ needs.check_changes.outputs.sdk_dotnet == 'true' }}
runs-on: windows-latest
permissions:
contents: write
Expand Down Expand Up @@ -226,6 +230,7 @@ jobs:
publish-go:
needs: check_changes
if: ${{ needs.check_changes.outputs.sdk_go == 'true' }}
runs-on: ubuntu-latest
permissions:
contents: write
Expand Down
2 changes: 1 addition & 1 deletion cli/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## inferable.ai CLI
## Inferable CLI

## Installation

Expand Down

0 comments on commit fee87be

Please sign in to comment.