feat: add @joai/product-variation-create warp for volume pricing tiers #567
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: Sync Warp Catalog | |
| on: | |
| push: | |
| branches: ["dev", "main"] | |
| paths: | |
| - 'warps/**' | |
| - 'scripts/catalog/**' | |
| - 'package.json' | |
| - 'package-lock.json' | |
| workflow_dispatch: | |
| inputs: | |
| full_sync: | |
| description: 'Run full sync (ignore previous manifest baseline)' | |
| required: false | |
| default: false | |
| type: boolean | |
| regenerate_all_screenshots: | |
| description: 'Regenerate screenshots for all brands (not just delta)' | |
| required: false | |
| default: false | |
| type: boolean | |
| concurrency: | |
| group: warp-sync-${{ github.ref_name }} | |
| cancel-in-progress: false | |
| jobs: | |
| sync-catalog: | |
| if: github.actor != 'github-actions[bot]' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Use Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20.x' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build catalog | |
| run: | | |
| FULL_FLAG="" | |
| if [ "${{ github.event.inputs.full_sync }}" = "true" ]; then | |
| FULL_FLAG="--full" | |
| fi | |
| node --import tsx scripts/catalog/build-catalog.ts $FULL_FLAG --branch "${GITHUB_REF_NAME}" --commit "${GITHUB_SHA}" --repo "${GITHUB_REPOSITORY}" | |
| - name: Generate warp screenshots | |
| run: | | |
| if [ "${{ github.event.inputs.regenerate_all_screenshots }}" = "true" ]; then | |
| node scripts/generate-screenshots.mjs --all | |
| else | |
| # Delta: only brands with changed files | |
| CHANGED_BRANDS=$(git diff --name-only HEAD~1 HEAD -- warps/ | cut -d'/' -f2 | sort -u) | |
| for brand in $CHANGED_BRANDS; do | |
| node scripts/generate-screenshots.mjs "$brand" 2>&1 || echo " ⚠ Screenshots skipped for $brand" | |
| done | |
| fi | |
| - name: Commit catalog and image changes | |
| run: | | |
| git config --global user.name 'github-actions[bot]' | |
| git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
| git add catalog warps/*/images/ | |
| git diff --quiet && git diff --staged --quiet || (git commit -m "chore: update warp catalog and images [skip ci]" && git pull --rebase && git push) | |
| - name: Sync delta to API | |
| env: | |
| WARP_GITHUB_SYNC_TOKEN: ${{ secrets.WARP_GITHUB_SYNC_TOKEN }} | |
| run: node --import tsx scripts/catalog/sync-to-api.ts --branch "${GITHUB_REF_NAME}" --commit "${GITHUB_SHA}" --repo "${GITHUB_REPOSITORY}" | |
| - name: Dispatch plugin sync | |
| env: | |
| JOAI_PLUGIN_SYNC_TOKEN: ${{ secrets.JOAI_PLUGIN_SYNC_TOKEN }} | |
| if: ${{ env.JOAI_PLUGIN_SYNC_TOKEN != '' }} | |
| uses: peter-evans/repository-dispatch@v3 | |
| with: | |
| token: ${{ env.JOAI_PLUGIN_SYNC_TOKEN }} | |
| repository: JoAiHQ/plugins | |
| event-type: warps_catalog_updated | |
| client-payload: >- | |
| {"warps_ref":"${{ github.ref_name }}","warps_sha":"${{ github.sha }}"} |