4.4.5 • Published 20 hours ago

@shopify/oxygen-cli v4.4.5

Weekly downloads
-
License
MIT
Repository
-
Last release
20 hours ago

Oxygen-cli

@shopify/oxygen-cli is a command-line tool for deploying your Oxygen projects. It provides a simple a way to deploy your Oxygen applications, including workers and assets, to the Oxygen platform.

Getting Started

The oxygen-cli can be run locally, or it can be used from within CI/CD environments such as Github Actions.

The common route to launch oxygen-cli's deploy command locally is through hydrogen-cli. When this is installed globally, the command is available via the h2 deploy.

You can also install oxygen-cli as plugin for @shopify/cli. When this is installed globally, running the following will install oxygen-cli:

shopify plugins install @shopify/oxygen-cli

The CLI will now expose its commands under shopify oxygen.

Finally, it is also possible to install the oxygen-cli independently, which is preferable when run from within a CI/CD environment.

npm install -g @shopify/oxygen-cli

The CLI can then be activated using the command oxygen-cli.

Command overview

  • oxygen deploy command initiates a deployment to Oxygen.
oxygen:deploy [options]

Options

  • -t, --token : (required) Oxygen deployment token. Can also be set using the OXYGEN_DEPLOYMENT_TOKEN environment variable (see below).
  • -p, --path : Root path (defaults to the current working directory).
  • -e, --environmentTag : Tag of the environment to deploy to. Defaults to branch name in supported CI environments (see below).
  • -w, --workerFolder : Worker folder (default: dist/worker/).
  • -a, --assetsFolder : Assets folder (default: dist/client/).
  • -o, --workerOnly: Worker only deployment.
  • -s, --skipBuild: Skip running build command.
  • -b, --buildCommand : Build command (default: yarn build).
  • -h, --skipHealthCheck: Skip running the health check on the deployment
  • -d, --healthCheckMaxDuration: The maximum duration (in seconds) that the health check is allowed to run before it is considered failed. Accepts values between 10 and 300.
  • --publicDeployment: set the deployment to be publicly accessible.
  • --metadataUrl : URL that links to the deployment.
  • --metadataUser : User that initiated the deployment.
  • --metadataVersion : A version identifier for the deployment.

Note: All metadata options (--metadataUrl, --metadataUser, and --metadataVersion) have a maximum character limit of 90.

Example:

oxygen:deploy -t my-deployment-token -e staging --path="/my-project" --workerOnly

This command will deploy your Oxygen project to the staging environment with the provided deployment token and root path. No static assets will be uploaded.

The environmentTag option and the metadata options serve as overrides for values that can be retrieved from supported CI environments, see the section on environment variables below.

Environment variables

The Oxygen deployment token can be specified with the token option. Alternatively, you can use the environment variable OXYGEN_DEPLOYMENT_TOKEN for this. In CI environments this is recommended. For example, when using CircleCI you can define a custom environment variable in your project settings which holds the token. The OXYGEN_DEPLOYMENT_TOKEN can then be populated with this variable's value in your config.yml file:

environment:
  OXYGEN_DEPLOYMENT_TOKEN: ${YOUR_ENV_VARIABLE}

When run from a supported CI/CD environment, the tool will automatically retrieve metadata from relevant environment variables. Metadata describes the author making the deployment (user), the version (commit Sha) and the deployment URL (workflow URL). This metadata will be saved and used to show details about the Oxygen deployment in the Hydrogen channel within the Shopify Admin.

The following environment variables are relevant, depending on your environment:

-BitbucketCircleCIGithubGitlab
UserBITBUCKET_COMMIT_AUTHORCIRCLE_USERNAMEGITHUB_ACTORGITLAB_USER_LOGIN
VersionBITBUCKET_COMMITCIRCLE_SHA1GITHUB_SHACI_COMMIT_SHA
URLBITBUCKET_BUILD_URLCIRCLE_BUILD_URL${GITHUB_SERVER_URL}${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}CI_PROJECT_URL

These values can be overridden by the command line flags metadataUser, metadataUrl and metadataVersion respectively.

The environment tag to deploy to will be derived from the following variables:

ServiceBranch
BitbucketBITBUCKET_BRANCH
CircleCICIRCLE_BRANCH
GithubGITHUB_REF_NAME
GitlabCI_COMMIT_REF_NAME

The environmentTag command line option can be used to override this. If not provided, or there is no environment with the specified tag, the deployment will be deployed to the default environment for the app (if one exists).

4.4.5

4 days ago

4.4.4

11 days ago

4.4.3

18 days ago

4.4.2

25 days ago

4.4.1

1 month ago

4.4.0

1 month ago

4.3.7

1 month ago

4.3.6

1 month ago

4.3.5

2 months ago

4.3.4

2 months ago

4.3.3

2 months ago

4.3.2

2 months ago

4.3.1

2 months ago

4.3.0

2 months ago

4.2.0

3 months ago

4.1.0

3 months ago

4.0.2

3 months ago

4.0.1

3 months ago

4.0.0

4 months ago

3.1.8

4 months ago

3.1.7

4 months ago

3.1.6

5 months ago

3.1.5

5 months ago

3.1.3

5 months ago

3.1.4

5 months ago

3.1.2

5 months ago

1.6.0

10 months ago

2.0.2

7 months ago

2.4.1

6 months ago

2.4.0

7 months ago

2.4.3

6 months ago

2.4.2

6 months ago

2.0.0

8 months ago

1.11.4

8 months ago

1.11.3

8 months ago

1.11.2

8 months ago

1.11.1

8 months ago

1.11.5

8 months ago

1.9.0

9 months ago

1.5.0

10 months ago

2.3.0

7 months ago

2.3.2

7 months ago

3.1.1

5 months ago

1.10.1

9 months ago

1.10.0

9 months ago

1.12.1

8 months ago

1.12.0

8 months ago

1.8.2

9 months ago

1.8.0

10 months ago

2.2.0

7 months ago

2.6.1

6 months ago

2.6.0

6 months ago

2.6.2

6 months ago

3.0.0

5 months ago

1.7.0

10 months ago

2.1.2

7 months ago

2.1.1

7 months ago

2.5.0

6 months ago

2.1.0

7 months ago

1.4.0

11 months ago

1.3.1

11 months ago

1.3.0

12 months ago

1.2.0

12 months ago

1.1.0

12 months ago

1.0.2

12 months ago