From 20ad4cfc887200f83be04732ece373ca0feb6cce Mon Sep 17 00:00:00 2001 From: "william.sam" Date: Wed, 29 Oct 2025 12:32:12 +1030 Subject: [PATCH 1/7] Create Shopify Workflow --- .github/workflows/shopify_deploy.yml | 76 ++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 .github/workflows/shopify_deploy.yml diff --git a/.github/workflows/shopify_deploy.yml b/.github/workflows/shopify_deploy.yml new file mode 100644 index 0000000..f1c9ad6 --- /dev/null +++ b/.github/workflows/shopify_deploy.yml @@ -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: './checkout-giftcard-app' + 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 }} \ No newline at end of file From f66d8726fcb6d389c619d1a043b3d9a1513d8889 Mon Sep 17 00:00:00 2001 From: "william.sam" Date: Thu, 30 Oct 2025 09:23:05 +1030 Subject: [PATCH 2/7] Added README section --- .github/workflows/shopify_deploy.yml | 2 +- README.md | 67 ++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+), 1 deletion(-) diff --git a/.github/workflows/shopify_deploy.yml b/.github/workflows/shopify_deploy.yml index f1c9ad6..ec5cf8b 100644 --- a/.github/workflows/shopify_deploy.yml +++ b/.github/workflows/shopify_deploy.yml @@ -16,7 +16,7 @@ on: description: 'Working directory for the app' required: false type: string - default: './checkout-giftcard-app' + default: '.' development-toml-name: description: 'Name of development.toml' required: false diff --git a/README.md b/README.md index b684d0a..1f98d32 100644 --- a/README.md +++ b/README.md @@ -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 }} +``` \ No newline at end of file From 0a1701ab208a900300f54a98209d448262d20c27 Mon Sep 17 00:00:00 2001 From: "william.sam" Date: Mon, 3 Nov 2025 12:36:16 +1030 Subject: [PATCH 3/7] Code review changes and updated README --- .github/workflows/shopify_deploy.yml | 26 ++++++++++---------------- README.md | 17 ++++++----------- 2 files changed, 16 insertions(+), 27 deletions(-) diff --git a/.github/workflows/shopify_deploy.yml b/.github/workflows/shopify_deploy.yml index ec5cf8b..cbdbe74 100644 --- a/.github/workflows/shopify_deploy.yml +++ b/.github/workflows/shopify_deploy.yml @@ -3,20 +3,15 @@ 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: '.' + deploy-production: + description: "Boolean to check if deploy to production" + type: boolean + default: false development-toml-name: description: 'Name of development.toml' required: false @@ -37,15 +32,14 @@ jobs: deploy: name: Deploy to Shopify runs-on: ubuntu-latest - environment: ${{ inputs.environment }} steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: Setup Node.js - uses: actions/setup-node@v4 + uses: actions/setup-node@v6 with: - node-version: ${{ inputs.node-version }} + node-version-file: '.nvmrc' cache: 'yarn' cache-dependency-path: ${{ inputs.working-directory }}/yarn.lock @@ -54,7 +48,7 @@ jobs: run: yarn install --frozen-lockfile - name: Download build artifacts - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v6 with: name: build-artifacts path: ${{ inputs.working-directory }} @@ -62,9 +56,9 @@ jobs: - name: Configure Shopify CLI working-directory: ${{ inputs.working-directory }} run: | - if [ "${{ inputs.environment }}" == "production" ]; then + if [ "${{ inputs.deploy-production }}" == "true" ]; then yarn shopify app config use ${{ inputs.production-toml-name }} - elif [ "${{ inputs.environment }}" == "development" ]; then + else yarn shopify app config use ${{ inputs.development-toml-name }} fi diff --git a/README.md b/README.md index 1f98d32..6921c2b 100644 --- a/README.md +++ b/README.md @@ -470,19 +470,17 @@ jobs: A streamlined Shopify app deployment workflow supporting both development and production environments with automatic configuration management. #### **Features** -- **Multi-environment support**: development and production deployments +- **Multi-environment support**: development and production deployments via `deploy-production` flag - **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 +- **Node.js version control**: Automatic detection from .nvmrc file 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 | +| **Deployment Configuration** | +| deploy-production | ❌ | boolean | false | Boolean to check if deploying to production | | working-directory | ❌ | string | . | Working directory for the app | | **Shopify Configuration** | | development-toml-name | ❌ | string | shopify.app.development.toml | Development TOML configuration file name | @@ -500,8 +498,6 @@ A streamlined Shopify app deployment workflow supporting both development and pr jobs: deploy-dev: uses: aligent/workflows/.github/workflows/shopify_deploy.yml@main - with: - environment: development secrets: shopify_cli_token: ${{ secrets.SHOPIFY_CLI_TOKEN }} ``` @@ -512,8 +508,7 @@ jobs: deploy-prod: uses: aligent/workflows/.github/workflows/shopify_deploy.yml@main with: - environment: production - node-version: '18' + deploy-production: true secrets: shopify_cli_token: ${{ secrets.SHOPIFY_CLI_TOKEN }} ``` @@ -524,7 +519,7 @@ jobs: deploy-custom: uses: aligent/workflows/.github/workflows/shopify_deploy.yml@main with: - environment: production + deploy-production: true working-directory: ./my-shopify-app development-toml-name: shopify.app.dev.toml production-toml-name: shopify.app.prod.toml From 3f2065ad2375de4132c69c00d27e49abd32747fc Mon Sep 17 00:00:00 2001 From: "william.sam" Date: Mon, 3 Nov 2025 12:39:18 +1030 Subject: [PATCH 4/7] Small Bash typo --- .github/workflows/shopify_deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/shopify_deploy.yml b/.github/workflows/shopify_deploy.yml index cbdbe74..9669f89 100644 --- a/.github/workflows/shopify_deploy.yml +++ b/.github/workflows/shopify_deploy.yml @@ -56,7 +56,7 @@ jobs: - name: Configure Shopify CLI working-directory: ${{ inputs.working-directory }} run: | - if [ "${{ inputs.deploy-production }}" == "true" ]; then + 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 }} From b1137de786569f2a4481c0ec93d835db729b6cec Mon Sep 17 00:00:00 2001 From: "william.sam" Date: Mon, 3 Nov 2025 16:04:51 +1030 Subject: [PATCH 5/7] Moved aws-access-key-id as a non-secret --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 42487fa..a7458ff 100644 --- a/README.md +++ b/README.md @@ -31,11 +31,11 @@ A streamlined AWS CDK deployment workflow supporting multi-environment infrastru | **Advanced Configuration** | | context-values | ❌ | string | {} | CDK context values as JSON object | | debug | ❌ | boolean | false | Enable verbose logging and debug output | +| aws-access-key-id | ✅ | AWS access key ID | #### **Secrets** | Name | Required | Description | |------|----------|-------------| -| aws-access-key-id | ✅ | AWS access key ID | | aws-secret-access-key | ✅ | AWS secret access key | | cfn-execution-role | ❌ | CloudFormation execution role ARN (optional, for cross-account deployments) | @@ -56,7 +56,7 @@ jobs: cdk-stack-name: my-app-dev environment-target: development secrets: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-access-key-id: ${{ vars.AWS_ACCESS_KEY_ID }} aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} ``` @@ -70,7 +70,7 @@ jobs: environment-target: production debug: true secrets: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-access-key-id: ${{ vars.AWS_ACCESS_KEY_ID }} aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} cfn-execution-role: ${{ secrets.CFN_EXECUTION_ROLE }} ``` @@ -86,7 +86,7 @@ jobs: bootstrap-stack: true aws-region: us-east-1 secrets: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-access-key-id: ${{ vars.AWS_ACCESS_KEY_ID }} aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} ``` @@ -100,7 +100,7 @@ jobs: environment-target: staging context-values: '{"vpc-id": "vpc-12345", "environment": "staging"}' secrets: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-access-key-id: ${{ vars.AWS_ACCESS_KEY_ID }} aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} ``` From 05fe2375fa5c12cafb9572d1c8c9fee5dfef61ec Mon Sep 17 00:00:00 2001 From: "william.sam" Date: Mon, 3 Nov 2025 16:12:20 +1030 Subject: [PATCH 6/7] Table layout correction --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a7458ff..0ea5194 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ A streamlined AWS CDK deployment workflow supporting multi-environment infrastru | **Advanced Configuration** | | context-values | ❌ | string | {} | CDK context values as JSON object | | debug | ❌ | boolean | false | Enable verbose logging and debug output | -| aws-access-key-id | ✅ | AWS access key ID | +| aws-access-key-id | ✅ | | | AWS access key ID | #### **Secrets** | Name | Required | Description | From 438c11fb4e5b5b77380fe124d52df5423395dcec Mon Sep 17 00:00:00 2001 From: "william.sam" Date: Tue, 4 Nov 2025 12:10:36 +1030 Subject: [PATCH 7/7] Resolving merge conflicts with chore/PJH-80_gadget_deploy --- README.md | 82 ------------------------------------------------------- 1 file changed, 82 deletions(-) diff --git a/README.md b/README.md index 7cff50c..7868935 100644 --- a/README.md +++ b/README.md @@ -547,88 +547,6 @@ jobs: gadget-api-token: ${{ secrets.GADGET_API_TOKEN }} ``` -### Gadget App Deployment489 - -A comprehensive Gadget app deployment workflow supporting push, test, and production deployment stages with multi-environment management. - -#### **Features** -- **Custom-environment support**: Support for custom development environment name -- **Conditional automated testing**: Automatic test execution controlled by boolean flag -- **Conditional deployment**: Production deployment controlled by boolean flag -- **Force push capabilities**: Ensures code synchronization with `--force` flag -- **Gadget CLI integration**: Uses `ggt` CLI tool for all operations -- **Test validation**: Runs full test suite before production deployment - -#### **Inputs** -| Name | Required | Type | Default | Description | -|------|----------|------|---------|-------------| -| **Core Configuration** | -| app-name | ✅ | string | | Gadget App name to deploy to (required) | -| test | ❌ | boolean | false | Enable testing on development environment (true/false) | -| deploy-production | ❌ | boolean | false | Enable production deployment (true/false) | -| **Environment Configuration** | -| environment-name | ❌ | string | staging | Main development environment name | - -#### **Secrets** -| Name | Required | Description | -|------|----------|-------------| -| gadget-api-token | ✅ | Gadget API authentication token | - -#### **Outputs** -| Name | Description | -|------|-------------| -| push-environment-status | Status of test environment push (success/failure) | - -#### **Example Usage** - -**Push to Staging Only:** -```yaml -jobs: - push-staging: - uses: aligent/workflows/.github/workflows/gadget-deploy.yml@main - with: - app-name: my-gadget-app - secrets: - gadget-api-token: ${{ secrets.GADGET_API_TOKEN }} -``` - -**Push with Testing:** -```yaml -jobs: - push-and-test: - uses: aligent/workflows/.github/workflows/gadget-deploy.yml@main - with: - app-name: my-gadget-app - test: true - secrets: - gadget-api-token: ${{ secrets.GADGET_API_TOKEN }} -``` - -**Full Deployment Pipeline (Push, Test, Deploy):** -```yaml -jobs: - deploy-production: - uses: aligent/workflows/.github/workflows/gadget-deploy.yml@main - with: - app-name: my-gadget-app - test: true - deploy-production: true - secrets: - gadget-api-token: ${{ secrets.GADGET_API_TOKEN }} -``` - -**Push to custom Environment Name:** -```yaml -jobs: - deploy-custom: - uses: aligent/workflows/.github/workflows/gadget-deploy.yml@main - with: - app-name: my-gadget-app - environment-name: development - secrets: - gadget-api-token: ${{ secrets.GADGET_API_TOKEN }} -``` - ### Shopify App Deployment A streamlined Shopify app deployment workflow supporting both development and production environments with automatic configuration management.