diff --git a/.github/workflows/shopify_deploy.yml b/.github/workflows/shopify_deploy.yml new file mode 100644 index 0000000..9669f89 --- /dev/null +++ b/.github/workflows/shopify_deploy.yml @@ -0,0 +1,70 @@ +name: Deploy to Shopify + +on: + workflow_call: + inputs: + 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 + 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 + steps: + - name: Checkout code + uses: actions/checkout@v5 + + - name: Setup Node.js + uses: actions/setup-node@v6 + with: + node-version-file: '.nvmrc' + 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@v6 + with: + name: build-artifacts + path: ${{ inputs.working-directory }} + + - 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 + + - 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