Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
40 changes: 5 additions & 35 deletions .github/workflows/shopify-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,10 @@ on:
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
shopify-toml-name:
description: 'Name of Shopify TOML file'
required: true
type: string
default: 'shopify.app.toml'

# Deployment Control
deploy-staging:
description: "Boolean to check if deploy to staging"
type: boolean
default: false
deploy-production:
description: "Boolean to check if deploy to production"
type: boolean
default: false

secrets:
shopify_cli_token:
Expand All @@ -39,13 +23,6 @@ jobs:
name: Deploy to Shopify
runs-on: ubuntu-latest
steps:
- name: Check deployment selection
if: ${{ inputs.deploy-staging == false && inputs.deploy-production == false }}
run: |
echo "Error: Neither 'deploy-staging' nor 'deploy-production' is selected."
echo "Please select at least one deployment target."
exit 1

- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd #v6.0.2
with:
Expand All @@ -69,16 +46,9 @@ jobs:

- name: Configure Shopify CLI
working-directory: ${{ inputs.working-directory }}
run: |
if [ "${INPUTS_DEPLOY_PRODUCTION}" = "true" ]; then
yarn shopify app config use ${INPUTS_PRODUCTION_TOML_NAME}
else
yarn shopify app config use ${INPUTS_DEVELOPMENT_TOML_NAME}
fi
run: yarn shopify app config use ${SHOPIFY_TOML_NAME}
env:
INPUTS_PRODUCTION_TOML_NAME: ${{ inputs.production-toml-name }}
INPUTS_DEVELOPMENT_TOML_NAME: ${{ inputs.development-toml-name }}
INPUTS_DEPLOY_PRODUCTION: ${{ inputs.deploy-production }}
SHOPIFY_TOML_NAME: ${{ inputs.shopify-toml-name }}

- name: Deploy to Shopify
working-directory: ${{ inputs.working-directory }}
Expand Down
31 changes: 4 additions & 27 deletions docs/shopify-deploy.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,16 @@
# Shopify App Deployment

A reusable workflow for deploying Shopify apps using the Shopify CLI with support for staging and production environments.
A reusable workflow for deploying Shopify apps using the Shopify CLI.

#### **Features**
- **Multi-environment support**: Deploy to staging or production using different TOML configuration files
- **Configurable working directory**: Support for monorepo structures with custom app locations
- **Build artifact integration**: Downloads pre-built artifacts before deployment
- **Shopify CLI integration**: Uses Shopify CLI for configuration and deployment
- **Deployment validation**: Ensures at least one deployment target is selected

#### **Inputs**
| Name | Required | Type | Default | Description |
|------|----------|------|---------|-------------|
| **Core Configuration** |
| working-directory | ❌ | string | . | Working directory for the app |
| development-toml-name | ❌ | string | shopify.app.development.toml | Name of development TOML config file |
| production-toml-name | ❌ | string | shopify.app.toml | Name of production TOML config file |
| **Deployment Control** |
| deploy-staging | ❌ | boolean | false | Enable staging deployment |
| deploy-production | ❌ | boolean | false | Enable production deployment |
| shopify-toml-name | ✅ | string | | Name of Shopify TOML configuration file |

#### **Secrets**
| Name | Required | Description |
Expand Down Expand Up @@ -46,7 +38,7 @@ jobs:
uses: aligent/workflows/.github/workflows/shopify-deploy.yml@main
with:
working-directory: apps/shopify-app
deploy-staging: true
shopify-toml-name: shopify.app.staging.toml
secrets:
shopify_cli_token: ${{ secrets.SHOPIFY_CLI_TOKEN }}
```
Expand All @@ -60,26 +52,11 @@ on:
...

jobs:
build:
deploy-production:
uses: aligent/workflows/.github/workflows/shopify-deploy.yml@main
with:
working-directory: apps/shopify-app
deploy-production: true
secrets:
shopify_cli_token: ${{ secrets.SHOPIFY_CLI_TOKEN }}
```

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