name: Sync Custom Pieces
on:
push:
branches:
- main
workflow_dispatch:
jobs:
sync-pieces:
runs-on: ubuntu-latest
steps:
# Step 1: Check out the repository code with full history
- name: Check out repository code
uses: actions/checkout@v3
with:
fetch-depth: 0
# Step 2: Cache Node.js dependencies
- name: Cache Node.js dependencies
uses: actions/cache@v3
with:
path: ~/.npm
key: npm-${{ hashFiles('package-lock.json') }}
restore-keys: |
npm-
# Step 3: Set up Node.js
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '20' # Use Node.js version 20
cache: 'npm'
# Step 4: Install dependencies using npm ci
- name: Install dependencies
run: npm ci --ignore-scripts
# Step 6: Sync Custom Pieces
- name: Sync Custom Pieces
env:
AP_API_KEY: ${{ secrets.AP_API_KEY }}
run: npm run sync-pieces -- --apiUrl ${{ secrets.INSTANCE_URL }}/api