技能 编程开发 Shopify CI/CD 自动化部署

Shopify CI/CD 自动化部署

v20260423
shopify-ci-integration
本技能用于为Shopify应用配置完整的CI/CD自动化流程。它利用GitHub Actions执行代码规范检查、单元测试、和关键的集成测试。支持API版本兼容性检查和通过Shopify CLI的自动化部署,确保电商应用发布过程稳定可靠。适用于需要建立自动化发布周期或监控API版本变化的场景。
获取技能
410 次下载
概览

Shopify CI Integration

Overview

Set up CI/CD pipelines for Shopify apps using GitHub Actions, including API version compatibility testing, Shopify CLI deployment, and extension validation.

Prerequisites

  • GitHub repository with Actions enabled
  • Shopify Partner account with CLI access
  • Test store access token for integration tests

Instructions

Step 1: GitHub Actions Workflow

Create a workflow with lint, test, API version check, and deploy jobs.

See GitHub Actions Workflow for the complete .github/workflows/shopify-ci.yml file.

Step 2: Configure Secrets

# Store these in GitHub repository secrets
gh secret set SHOPIFY_API_KEY --body "your_api_key"
gh secret set SHOPIFY_API_SECRET --body "your_api_secret"
gh secret set SHOPIFY_TEST_STORE --body "your-dev-store.myshopify.com"
gh secret set SHOPIFY_TEST_TOKEN --body "shpat_test_token"
gh secret set SHOPIFY_PARTNERS_TOKEN --body "your_partners_cli_token"

Step 3: Integration Test Structure

Write integration tests that verify store connectivity, required scopes, and rate limit compliance. Tests skip automatically when SHOPIFY_ACCESS_TOKEN is not set.

See Integration Test Structure for the complete Vitest test file.

Output

  • CI pipeline with lint, typecheck, unit tests, and integration tests
  • API version deprecation monitoring
  • Automated deployment via Shopify CLI
  • Integration tests running against a test store

Error Handling

Issue Cause Solution
SHOPIFY_PARTNERS_TOKEN invalid Token expired Regenerate at partners.shopify.com
Integration tests timeout Rate limited Add delays or use test store with Plus
API version check fails Deprecated version Update to latest supported version
Deploy fails App config mismatch Run shopify app config push first

Examples

Shopify CLI Token for CI

# Generate a CLI token for CI (no interactive login needed)
# Go to: partners.shopify.com > Settings > CLI tokens
# Create a new token and save as SHOPIFY_PARTNERS_TOKEN secret

Resources

信息
Category 编程开发
Name shopify-ci-integration
版本 v20260423
大小 3.3KB
更新时间 2026-04-28
语言