fix(export): rename Scripts to CLI Commands for consistency #54
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: Release | |
| on: | |
| push: | |
| branches: | |
| - main | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| packages: write | |
| jobs: | |
| release-please: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| release_created: ${{ steps.release.outputs.release_created }} | |
| tag_name: ${{ steps.release.outputs.tag_name }} | |
| version: ${{ steps.release.outputs.version }} | |
| steps: | |
| - name: Run Release Please | |
| uses: googleapis/release-please-action@v4 | |
| id: release | |
| with: | |
| release-type: simple | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| - name: Run unit tests | |
| run: | | |
| for skill_dir in plugins/splunk-assistant-skills/skills/*/tests/; do | |
| if [ -d "$skill_dir" ]; then | |
| skill_name=$(basename $(dirname $skill_dir)) | |
| # Check if there are any test files (not just live_integration) | |
| test_files=$(find "$skill_dir" -maxdepth 1 -name "test_*.py" -o -name "*_test.py" 2>/dev/null | head -1) | |
| if [ -n "$test_files" ]; then | |
| echo "Testing $skill_name..." | |
| python -m pytest "$skill_dir" -v \ | |
| --ignore="${skill_dir}live_integration" \ | |
| || exit 1 | |
| else | |
| echo "Skipping $skill_name (no unit tests)" | |
| fi | |
| fi | |
| done | |
| publish-release: | |
| needs: [release-please, test] | |
| if: ${{ needs.release-please.outputs.release_created }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| - name: Run tests | |
| run: | | |
| pip install pytest pytest-asyncio | |
| for skill_dir in plugins/splunk-assistant-skills/skills/*/tests/; do | |
| if [ -d "$skill_dir" ]; then | |
| skill_name=$(basename $(dirname $skill_dir)) | |
| # Check if there are any test files (not just live_integration) | |
| test_files=$(find "$skill_dir" -maxdepth 1 -name "test_*.py" -o -name "*_test.py" 2>/dev/null | head -1) | |
| if [ -n "$test_files" ]; then | |
| echo "Testing $skill_name..." | |
| python -m pytest "$skill_dir" -v \ | |
| --ignore="${skill_dir}live_integration" \ | |
| || exit 1 | |
| else | |
| echo "Skipping $skill_name (no unit tests)" | |
| fi | |
| fi | |
| done | |
| - name: Create release archive | |
| run: | | |
| VERSION=${{ needs.release-please.outputs.version }} | |
| mkdir -p dist | |
| tar -czvf dist/splunk-assistant-skills-${VERSION}.tar.gz \ | |
| --exclude='*/tests/*' \ | |
| --exclude='*/docs/*' \ | |
| --exclude='__pycache__' \ | |
| --exclude='*.pyc' \ | |
| .claude-plugin/ \ | |
| plugins/ \ | |
| CLAUDE.md \ | |
| README.md \ | |
| VERSION | |
| - name: Upload release assets | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| VERSION=${{ needs.release-please.outputs.version }} | |
| gh release upload v${VERSION} dist/splunk-assistant-skills-${VERSION}.tar.gz --clobber | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Install linting tools | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install black isort mypy | |
| - name: Check formatting with Black | |
| run: | | |
| black --check --diff plugins/splunk-assistant-skills/skills/ | |
| - name: Check imports with isort | |
| run: | | |
| isort --check-only --diff plugins/splunk-assistant-skills/skills/ | |
| publish-docker: | |
| needs: [release-please, test] | |
| if: ${{ needs.release-please.outputs.release_created }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract metadata for Docker | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ghcr.io/${{ github.repository }} | |
| tags: | | |
| type=semver,pattern={{version}},value=${{ needs.release-please.outputs.version }} | |
| type=semver,pattern={{major}}.{{minor}},value=${{ needs.release-please.outputs.version }} | |
| type=semver,pattern={{major}},value=${{ needs.release-please.outputs.version }} | |
| type=raw,value=latest | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| file: ./docker/e2e/Dockerfile | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max |