Publishing Content from an Old to a New Environment

Suppose you’ve published content (entries or assets) to an environment (for example, staging), and you want to publish this content to another environment (for example, production). In that case, you can do it by manually publishing the content.

However, this manual method would be cumbersome if there are a large number of content pieces.

This guide explains how to reduce manual efforts for publishing content from one environment to another; thus saving time.

Use Releases

Releases in Contentstack lets you group the content pieces, which you can publish to a particular environment at once.

Here’s an overview of the process of using releases to publish content (previously published on the “staging” environment) to the “production” environment:

  1. Use Sync APIs: The first step is to use the Sync API requests. Using the Initial sync API request on the “staging” environment, you’ll get all the published entries and assets in the response.
  2. Add items to the release: Store the UIDs of the assets and entries (returned through the Sync API), and then use the Add multiple items to a release API request. This API request will add entries and assets to a release in Contentstack. Next, create multiple releases to store all the content items.

    Alternatively, you can publish content directly to the new environment. However, you need to be careful with this option as you might end up reaching rate limiting. Therefore, you'll have to find a way to handle retries.

  3. Deploy your release: Lastly, when you add all the content items to the releases, deploy them to the “production” environment to get them published. Read more on deploying a release.

Once the release is deployed successfully, you’ll see all the content published on the new environment.

Use our Bulk Publishing Script

Another way to do this quickly is to use the bulk-publish-entries-assets script. It automates the process of publishing content (entries and assets) from one environment to a newly created or any other environment.

Learn more on how to bulk publish entries and assets from one environment to another.

Use Contentstack Command-line Interface

By using Contentstack CLI, you can publish content from one environment to another by running the cm:bulk-publish:cross-publish command.

Learn more about how to do this in our detailed documentation.

Was this article helpful?