cs-icon.svg

Trigger Deployments on Launch Platform based on Tags/Releases

This step-by-step guide explains how to configure automatic deployments on the Launch platform whenever you create a new tag or a release in your Git repository.

Prerequisites

  1. Contentstack account
  2. Access to Launch for your organization
  3. Git repository for your project

Steps for Execution

  1. Create a Launch Deploy Hook

    Log in to your Contentstack account and perform the following steps:

    1. Click Launch from the left navigation panel as shown below. Launch_New_CS_Logo_Launch_Icon.png
    2. On the Projects landing page, select your project.
    3. Navigate to the Launch Environment Settings page.
    4. Create a new Deploy Hook.
    5. Copy the generated Deploy Hook URL. You'll need this in the next step.
  2. Create a GitHub Action

    1. Create a GitHub Action that triggers the deployment whenever a tag or a release is pushed to your repository.
    2. Add the following GitHub workflow YAML template to your GitHub repository and replace values as needed:
      name: Launch Deployment on Content Change (Template)
      on:
        push:
          tags:
            - 'content/*'  # Triggers on any tag starting with "content/" (Change as needed)
      jobs:
        deploy:
          runs-on: ubuntu-latest
          steps:
            - name: Deploy to Launch (**Please configure!**)
              run: |
                # Replace YOUR_DEPLOY_HOOK_URL with actual values
                curl -X POST https://<YOUR_DEPLOY_HOOK_URL>?commit=${{ github.sha }}
                # Add any additional steps required for your deployment process (e.g., build)
      

    Additional Resource: You can also refer to the sample file in the example repository here.

  3. Save and Activate the Workflow

    After replacing the placeholders and customizing the trigger pattern (if necessary), save the workflow file in your GitHub repository.

    This action activates the workflow, causing it to trigger automatically whenever you push a new tag that matches the specified pattern.

This setup enables automated deployments to your Launch environment whenever you create a new content release with the appropriate tag. Remember to update the workflow file if your deployment process or tagging convention changes.

Was this article helpful?
^