Enhance analyze_image tool to support URLs, file paths, and data URIs #13
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/CD Pipeline | |
on: | |
push: | |
branches: [ main ] | |
tags: [ 'v*' ] | |
pull_request: | |
branches: [ main ] | |
# Prevent multiple concurrent builds of the same branch/PR | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
cache: 'npm' | |
cache-dependency-path: package-lock.json | |
- name: Verify Node.js and npm versions | |
run: | | |
node --version | |
npm --version | |
- name: Cache dependencies | |
uses: actions/cache@v4 | |
id: npm-cache | |
with: | |
path: | | |
**/node_modules | |
~/.npm | |
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-npm- | |
- name: Configure npm | |
run: | | |
npm config set strict-ssl false | |
npm config set registry https://registry.npmjs.org/ | |
npm config set fetch-retry-mintimeout 20000 | |
npm config set fetch-retry-maxtimeout 120000 | |
- name: Install dependencies | |
if: steps.npm-cache.outputs.cache-hit != 'true' | |
run: npm cache clean --force && npm install --legacy-peer-deps --no-optional | |
- name: Cache build output | |
uses: actions/cache@v4 | |
with: | |
path: dist | |
key: ${{ runner.os }}-build-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-build- | |
- name: Build TypeScript | |
run: npm run build | |
- name: Run tests | |
run: npm test || echo "No tests found" | |
- name: Upload build artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: dist | |
path: dist/ | |
publish-npm: | |
needs: build | |
if: startsWith(github.ref, 'refs/tags/v') | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
registry-url: 'https://registry.npmjs.org' | |
cache: 'npm' | |
cache-dependency-path: package-lock.json | |
- name: Verify Node.js and npm versions | |
run: | | |
node --version | |
npm --version | |
- name: Cache dependencies | |
uses: actions/cache@v4 | |
id: npm-cache | |
with: | |
path: | | |
**/node_modules | |
~/.npm | |
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-npm- | |
- name: Configure npm | |
run: | | |
npm config set strict-ssl false | |
npm config set registry https://registry.npmjs.org/ | |
npm config set fetch-retry-mintimeout 20000 | |
npm config set fetch-retry-maxtimeout 120000 | |
- name: Install dependencies | |
if: steps.npm-cache.outputs.cache-hit != 'true' | |
run: npm cache clean --force && npm install --legacy-peer-deps --no-optional | |
- name: Download build artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: dist | |
path: dist/ | |
- name: Publish to npm | |
run: npm publish --access=public | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPMJS_TOKEN }} | |
docker: | |
needs: build | |
runs-on: ubuntu-latest | |
if: github.event_name != 'pull_request' | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Cache Docker layers | |
uses: actions/cache@v4 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-buildx- | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Login 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: | | |
${{ secrets.DOCKERHUB_USERNAME }}/openrouter-mcp-multimodal | |
ghcr.io/${{ github.repository_owner }}/openrouter-mcp-multimodal | |
tags: | | |
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }} | |
type=semver,pattern={{version}},enable=${{ startsWith(github.ref, 'refs/tags/v') }} | |
type=semver,pattern={{major}}.{{minor}},enable=${{ startsWith(github.ref, 'refs/tags/v') }} | |
type=semver,pattern={{major}},enable=${{ startsWith(github.ref, 'refs/tags/v') }} | |
type=sha,format=short | |
type=ref,event=branch | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: | | |
type=gha | |
type=local,src=/tmp/.buildx-cache | |
cache-to: | | |
type=gha,mode=max | |
type=local,dest=/tmp/.buildx-cache-new,mode=max | |
build-args: | | |
NPM_CONFIG_STRICT_SSL=false | |
NPM_CONFIG_REGISTRY=https://registry.npmjs.org/ | |
NPM_CONFIG_FETCH_RETRY_MINTIMEOUT=20000 | |
NPM_CONFIG_FETCH_RETRY_MAXTIMEOUT=120000 | |
NODE_ENV=development | |
# Temp fix for https://github.com/docker/build-push-action/issues/252 | |
# https://github.com/moby/buildkit/issues/1896 | |
- name: Move cache | |
run: | | |
rm -rf /tmp/.buildx-cache | |
mv /tmp/.buildx-cache-new /tmp/.buildx-cache |