Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 76 additions & 0 deletions .github/workflows/shopify_deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Deploy to Shopify

on:
workflow_call:
inputs:
environment:
description: 'Deployment environment (development/production)'
required: true
type: string
node-version:
description: 'Node.js version'
required: false
type: string
default: '20'
working-directory:
description: 'Working directory for the app'
required: false
type: string
default: '.'
development-toml-name:
description: 'Name of development.toml'
required: false
type: string
default: 'shopify.app.development.toml'
production-toml-name:
description: 'Name of .toml'
required: false
type: string
default: 'shopify.app.toml'

secrets:
shopify_cli_token:
description: 'Shopify CLI authentication token'
required: true

jobs:
deploy:
name: Deploy to Shopify
runs-on: ubuntu-latest
environment: ${{ inputs.environment }}
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ inputs.node-version }}
cache: 'yarn'
cache-dependency-path: ${{ inputs.working-directory }}/yarn.lock

- name: Install dependencies
working-directory: ${{ inputs.working-directory }}
run: yarn install --frozen-lockfile

- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: build-artifacts
path: ${{ inputs.working-directory }}

- name: Configure Shopify CLI
working-directory: ${{ inputs.working-directory }}
run: |
if [ "${{ inputs.environment }}" == "production" ]; then
yarn shopify app config use ${{ inputs.production-toml-name }}
elif [ "${{ inputs.environment }}" == "development" ]; then
yarn shopify app config use ${{ inputs.development-toml-name }}
fi

- name: Deploy to Shopify
working-directory: ${{ inputs.working-directory }}
run: yarn shopify app deploy --force
env:
SHOPIFY_CLI_TOKEN: ${{ secrets.shopify_cli_token }}
SHOPIFY_FLAG_PATH: ${{ inputs.working-directory }}
67 changes: 67 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -464,3 +464,70 @@ jobs:
coverage-threshold: "90"
composer-args: "--no-dev"
```

### Shopify App Deployment

A streamlined Shopify app deployment workflow supporting both development and production environments with automatic configuration management.

#### **Features**
- **Multi-environment support**: development and production deployments
- **Configuration management**: Automatic selection of environment-specific TOML files
- **Build artifact integration**: Downloads and deploys pre-built artifacts
- **Node.js version control**: Configurable Node.js version with Yarn caching
- **Force deployment**: Ensures deployment proceeds without manual prompts

#### **Inputs**
| Name | Required | Type | Default | Description |
|------|----------|------|---------|-------------|
| **Environment Configuration** |
| environment | ✅ | string | | Deployment environment (development/production) |
| **Build Configuration** |
| node-version | ❌ | string | 20 | Node.js version to use |
| working-directory | ❌ | string | . | Working directory for the app |
| **Shopify Configuration** |
| development-toml-name | ❌ | string | shopify.app.development.toml | Development TOML configuration file name |
| production-toml-name | ❌ | string | shopify.app.toml | Production TOML configuration file name |

#### **Secrets**
| Name | Required | Description |
|------|----------|-------------|
| shopify_cli_token | ✅ | Shopify CLI authentication token |

#### **Example Usage**

**Development Deployment:**
```yaml
jobs:
deploy-dev:
uses: aligent/workflows/.github/workflows/shopify_deploy.yml@main
with:
environment: development
secrets:
shopify_cli_token: ${{ secrets.SHOPIFY_CLI_TOKEN }}
```

**Production Deployment:**
```yaml
jobs:
deploy-prod:
uses: aligent/workflows/.github/workflows/shopify_deploy.yml@main
with:
environment: production
node-version: '18'
secrets:
shopify_cli_token: ${{ secrets.SHOPIFY_CLI_TOKEN }}
```

**Custom Configuration:**
```yaml
jobs:
deploy-custom:
uses: aligent/workflows/.github/workflows/shopify_deploy.yml@main
with:
environment: production
working-directory: ./my-shopify-app
development-toml-name: shopify.app.dev.toml
production-toml-name: shopify.app.prod.toml
secrets:
shopify_cli_token: ${{ secrets.SHOPIFY_CLI_TOKEN }}
```