Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't use magic comments - pass the storefront ID as parameter #63

Closed
magnattic opened this issue Sep 18, 2023 · 3 comments
Closed

Don't use magic comments - pass the storefront ID as parameter #63

magnattic opened this issue Sep 18, 2023 · 3 comments

Comments

@magnattic
Copy link

I just stumbled hard across this problem:

Why are you using magic comments at the top of the workflow file to identify the storefront ID?

# Don't change the line below!
#! oxygen_storefront_id: 1000000001

This makes it impossible to deploy to multiple storefronts from the same workflow. Also, it is very obscure and easy to break.

Is there a specific reason to not simply pass the storefront id as normal parameter? (or just derive it from the deployment token)

- name: Build and Publish to Oxygen
  id: deploy
  uses: shopify/oxygenctl-action@v4
  with:
    storefront_id: 1000000001
    oxygen_deployment_token: ${{ secrets.OXYGEN_DEPLOYMENT_TOKEN_10000000001 }}
    build_command: 'HYDROGEN_ASSET_BASE_URL=$OXYGEN_ASSET_BASE_URL npm build'

Bonus points:

  • It would be nice not to tightly couple the branch to the environment, but to enable us to deploy to two separate environments from the same branch.

For context, here is what we want to do (optimally in a single workflow):

  1. Merge code into main branch
  2. Deploy main branch to staging environment
  3. Automatically test staging environment
  4. If green, deploy main branch to production environment

This is impossible right now, since each branch is tied to an environment and each workflow file is tied to a single storefront.

@jgodson
Copy link
Contributor

jgodson commented Nov 23, 2023

Sorry we had not seen this previously. Thank you for the feedback!

We are working on a few different features in Oxygen. The result of that work should be the desired workflow you specified being possible in the near future.

@jgodson jgodson closed this as completed Aug 21, 2024
@lukeclifton
Copy link

Hey @jgodson Is there any update on this? We also need the ability to have a single workflow file to support multiple store deployments.

@jgodson
Copy link
Contributor

jgodson commented Oct 25, 2024

Hey @lukeclifton, yes this comment is no longer required!

The CLI provides some options to deploy to different environments, which should allow you to deploy to multiple environments within a single workflow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants